Repository: gto76/python-cheatsheet Branch: main Commit: 87597a8ec37b Files: 40 Total size: 1.9 MB Directory structure: gitextract_fslh2m2x/ ├── README.md ├── index.html ├── parse.js ├── pdf/ │ ├── Acrobat/ │ │ ├── Chapter_1.xml │ │ ├── bottom_line.xml │ │ ├── chapter_2.xml │ │ ├── chapter_3.xml │ │ ├── chapter_4.xml │ │ ├── chapter_5.xml │ │ ├── chapter_6.xml │ │ ├── chapter_7.xml │ │ ├── chapter_8.xml │ │ ├── even_pages.xml │ │ └── odd_pages.xml │ ├── README.md │ ├── create_index.py │ ├── index_for_pdf.html │ ├── index_for_pdf_print.html │ ├── popup.html │ └── remove_links.py └── web/ ├── OnlineWebFonts_COM_cb7eb796ae7de7195a34c485cacebad1/ │ ├── @font-face/ │ │ └── Demo.html │ ├── License.txt │ └── Online_Web_Fonts.url ├── OnlineWebFonts_COM_d6ba633f6ea4cafe1a39ab736fe55e88/ │ ├── License.txt │ ├── Menlo Bold/ │ │ └── @font-face/ │ │ └── Demo.html │ └── Online_Web_Fonts.url ├── continents.csv ├── convert_table.py ├── covid_cases.js ├── covid_deaths.js ├── empty_script.py ├── faq.html ├── script_2.js ├── style.css ├── style_dark.css ├── style_dark1.css ├── style_dark2.css ├── style_dark3.css ├── template.html └── update_plots.py ================================================ FILE CONTENTS ================================================ ================================================ FILE: README.md ================================================ Comprehensive Python Cheatsheet =============================== [Download text file](https://raw.githubusercontent.com/gto76/python-cheatsheet/main/README.md), [Fork me on GitHub](https://github.com/gto76/python-cheatsheet) or [Check out FAQ](https://github.com/gto76/python-cheatsheet/wiki/Frequently-Asked-Questions). ![Monty Python](web/image_888.jpeg) Contents -------- **   ** **1. Collections:** **  ** **[`List`](#list)**__,__ **[`Dictionary`](#dictionary)**__,__ **[`Set`](#set)**__,__ **[`Tuple`](#tuple)**__,__ **[`Range`](#range)**__,__ **[`Enumerate`](#enumerate)**__,__ **[`Iterator`](#iterator)**__,__ **[`Generator`](#generator)**__.__ **   ** **2. Types:** **            ** **[`Type`](#type)**__,__ **[`String`](#string)**__,__ **[`Regular_Exp`](#regex)**__,__ **[`Format`](#format)**__,__ **[`Numbers`](#numbers-1)**__,__ **[`Combinatorics`](#combinatorics)**__,__ **[`Datetime`](#datetime)**__.__ **   ** **3. Syntax:** **          ** **[`Function`](#function)**__,__ **[`Inline`](#inline)**__,__ **[`Import`](#imports)**__,__ **[`Decorator`](#decorator)**__,__ **[`Class`](#class)**__,__ **[`Duck_Type`](#duck-types)**__,__ **[`Enum`](#enum)**__,__ **[`Except`](#exceptions)**__.__ **   ** **4. System:** **         ** **[`Exit`](#exit)**__,__ **[`Print`](#print)**__,__ **[`Input`](#input)**__,__ **[`Command_Line_Arguments`](#command-line-arguments)**__,__ **[`Open`](#open)**__,__ **[`Path`](#paths)**__,__ **[`OS_Commands`](#os-commands)**__.__ **   ** **5. Data:** **              ** **[`JSON`](#json)**__,__ **[`Pickle`](#pickle)**__,__ **[`CSV`](#csv)**__,__ **[`SQLite`](#sqlite)**__,__ **[`Bytes`](#bytes)**__,__ **[`Struct`](#struct)**__,__ **[`Array`](#array)**__,__ **[`Memory_View`](#memory-view)**__,__ **[`Deque`](#deque)**__.__ **   ** **6. Advanced:** **    ** **[`Operator`](#operator)**__,__ **[`Match_Statement`](#match-statement)**__,__ **[`Logging`](#logging)**__,__ **[`Introspection`](#introspection)**__,__ **[`Threads`](#threading)**__,__ **[`Asyncio`](#asyncio)**__.__ **   ** **7. Libraries:** **      ** **[`Progress_Bar`](#progress-bar)**__,__ **[`Plot`](#plot)**__,__ **[`Table`](#table)**__,__ **[`Console_App`](#console-app)**__,__ **[`GUI`](#gui-app)**__,__ **[`Scraping`](#scraping)**__,__ **[`Web`](#web-app)**__,__ **[`Profile`](#profiling)**__.__ **   ** **8. Multimedia:** ** ** **[`NumPy`](#numpy)**__,__ **[`Image`](#image)**__,__ **[`Animation`](#animation)**__,__ **[`Audio`](#audio)**__,__ **[`Synthesizer`](#synthesizer)**__,__ **[`Pygame`](#pygame)**__,__ **[`Pandas`](#pandas)**__,__ **[`Plotly`](#plotly)**__.__ Main ---- ```python if __name__ == '__main__': # Skips indented lines of code if file was imported. main() # Executes user-defined `def main(): ...` function. ``` List ---- ```python = [, , ...] # Creates new list object. E.g. `list_a = [1, 2, 3]`. ``` ```python = [index] # First index is 0, last -1. Also `[i] = `. = [] # Also [from_inclusive : to_exclusive : ±step]. ``` ```python .append() # Appends element to the end. Also ` += []`. .extend() # Appends multiple elements. Also ` += `. ``` ```python .sort(reverse=False) # Sorts the elements of the list in ascending order. .reverse() # Reverses the order of elements. Takes linear time. = sorted() # Returns a new sorted list. Accepts `reverse=True`. = reversed() # Returns reversed iterator. Also list(). ``` ```python = max() # Returns the largest element. Also min(, ...). = sum() # Returns a sum of elements. Also math.prod(). ``` ```python elementwise_sum = [sum(pair) for pair in zip(list_a, list_b)] sorted_by_second = sorted(, key=lambda pair: pair[1]) sorted_by_both = sorted(, key=lambda p: (p[1], p[0])) flatter_list = list(itertools.chain.from_iterable()) ``` * **For details about sort(), sorted(), min() and max() see [Sortable](#sortable).** * **Module [operator](#operator) has function itemgetter() that can replace listed [lambdas](#lambda).** * **This text uses the term collection instead of [iterable](#abstract-base-classes). For rationale see [duck types](#iterable-duck-types).** ```python = len() # Returns number of items. Doesn't accept iterators. = .count() # Counts occurrences. Also `if in : ...`. = .index() # Returns index of first occ. or raises ValueError. = .pop() # Removes item from the end (or at index if passed). .insert(, ) # Inserts item at index and shifts remaining items. .remove() # Removes the first occurrence or raises ValueError. .clear() # Removes all items. Also provided by dict and set. ``` Dictionary ---------- ```python = {key_1: val_1, key_2: val_2, ...} # Use `[key]` to get or assign the value. ``` ```python = .keys() # A collection of keys reflecting all changes. = .values() # A collection of values that reflects changes. = .items() # Coll. of tuples. Each contains key and value. ``` ```python value = .get(key, default=None) # Returns 'default' argument if key is missing. value = .setdefault(key, default=None) # Returns and writes 'default' if key is amiss. = collections.defaultdict() # Dict with automatic default value `()`. = collections.defaultdict(lambda: 1) # Dictionary with automatic default value `1`. ``` ```python = dict() # Creates a dict from coll. of key-value pairs. = dict(zip(keys, values)) # Creates key-value pairs from two collections. = dict.fromkeys(keys [, value]) # Items get value None if only keys are passed. ``` ```python .update() # Adds items to dict. Passed dict has priority. value = .pop(key) # Removes item or raises KeyError when missing. {k for k, v in .items() if v == 123} # Returns a set of keys whose value equals 123. {k: v for k, v in .items() if k in keys} # Returns a dict of items with specified keys. ``` ### Counter ```python >>> from collections import Counter >>> counter = Counter(['blue', 'blue', 'red']) >>> counter['yellow'] += 3 >>> print(counter.most_common()) [('yellow', 3), ('blue', 2), ('red', 1)] ``` Set --- ```python = {, , ...} # Coll. of unique items. Also set(), set(). ``` ```python .add() # Adds item to the set. Same as ` |= {}`. .update( [, ...]) # Adds items to the set. Same as ` |= `. ``` ```python = .union() # Returns a set of all items. Also | . = .intersection() # Returns every shared item. Also & . = .difference() # Returns set's unique items. Also - . = .symmetric_diff…() # Returns all nonshared items. Also ^ . = .issuperset() # Returns False when collection has unique items. = .issubset() # Is collection a superset? Also <= . ``` ```python = .pop() # Removes one of items. Raises KeyError if empty. .remove() # Removes the item or raises KeyError if missing. .discard() # Same as remove() but it doesn't raise an error. ``` ### Frozen Set * **Frozenset is immutable and hashable version of the normal set.** * **That means it can be used as a key in a dictionary or as an item in a set.** ```python = frozenset() ``` Tuple ----- **Tuple is an immutable and hashable list.** ```python = () # Returns an empty tuple. Also tuple(), tuple(). = (,) # Returns a tuple with single element. Same as `,`. = (, [, ...]) # Returns a tuple. Same as `, [, ...]`. ``` ### Named Tuple **Tuple's subclass with named elements.** ```python >>> from collections import namedtuple >>> Point = namedtuple('Point', 'x y') >>> p = Point(1, y=2) >>> print(p) Point(x=1, y=2) >>> p.x, p[1] (1, 2) ``` Range ----- **A sequence of evenly spaced integers.** ```python = range(stop) # I.e. range(to_exclusive). Integers from 0 to `stop-1`. = range(start, stop) # I.e. range(from_inc, to_exc). From start to `stop-1`. = range(start, stop, ±step) # I.e. range(from_inclusive, to_exclusive, ±step_size). ``` ```python >>> [i for i in range(3)] [0, 1, 2] ``` Enumerate --------- ```python for i, el in enumerate(, start=0): # Returns next element and its index on each pass. ... ``` Iterator -------- **Potentially endless stream of elements.** ```python = iter() # Iterator that returns passed elements one by one. = iter(, to_exc) # Calls `()` until it receives 'to_exc' value. = ( for in ) # E.g. `(i+1 for i in range(3))`. Evaluates lazily. = next( [, default]) # Raises StopIteration or returns 'default' on end. = list() # Returns a list of iterator's remaining elements. ``` * **For loops call `'iter()'` at the start and `'next()'` on each pass.** * **Calling `'iter()'` returns unmodified iterator. For details see [Iterator](#iterator-1) duck type.** ```python import itertools as it ``` ```python = it.count(start=0, step=1) # Returns updated 'start' endlessly. Accepts floats. = it.repeat( [, times]) # Returns passed element endlessly or 'times' times. = it.cycle() # Repeats the sequence endlessly. Accepts iterators. ``` ```python = it.chain(, , ...) # Returns each element of each collection in order. = it.chain.from_iterable() # Accepts collection (i.e. iterable) of collections. = it.islice(, stop) # Also accepts 'start' and 'step'. Args can be None. = it.product(, ) # Same as `((a, b) for a in arg_1 for b in arg_2)`. ``` Generator --------- * **Any function that contains a yield statement returns a generator.** * **Generators and iterators are interchangeable.** ```python def count(start, step): while True: yield start start += step ``` ```python >>> counter = count(10, 2) >>> next(counter), next(counter), next(counter) (10, 12, 14) ``` Type ---- * **Everything in Python is an object.** * **Every object has a certain type.** * **Type and class are synonymous.** ```python = type() # Object's type. Same as `.__class__`. = isinstance(, ) # Same as `issubclass(type(), )`. ``` ```python >>> type('a'), 'a'.__class__, str (, , ) ``` #### Some types do not have built-in names, so they must be imported: ```python from types import FunctionType, MethodType, LambdaType, GeneratorType ``` ### Abstract Base Classes **Each abstract base class specifies a set of virtual subclasses. These classes are then recognized by isinstance() and issubclass() as [subclasses](#subclass) of the ABC, although they are really not. An ABC can also manually decide whether or not a specific class is its virtual subclass, usually based on which methods that class has implemented. For instance, Iterable ABC looks for method iter(), while Collection ABC looks for iter(), contains() and len().** ```python >>> from collections.abc import Iterable, Collection, Sequence >>> isinstance([1, 2, 3], Iterable) True ``` ```text +------------------+------------+------------+------------+ | | Iterable | Collection | Sequence | +------------------+------------+------------+------------+ | list, range, str | yes | yes | yes | | dict, set | yes | yes | | | iter | yes | | | +------------------+------------+------------+------------+ ``` ```python >>> from numbers import Number, Complex, Real, Rational, Integral >>> isinstance(123, Number) True ``` ```text +--------------------+-----------+-----------+----------+----------+----------+ | | Number | Complex | Real | Rational | Integral | +--------------------+-----------+-----------+----------+----------+----------+ | int | yes | yes | yes | yes | yes | | fractions.Fraction | yes | yes | yes | yes | | | float | yes | yes | yes | | | | complex | yes | yes | | | | | decimal.Decimal | yes | | | | | +--------------------+-----------+-----------+----------+----------+----------+ ``` String ------ **Immutable sequence of characters.** ```python = 'abc' # Also "abc". Interprets \n, \t, \x00-\xff, etc. ``` ```python = .strip() # Strips all whitespace characters from both ends. = .strip('') # Strips passed characters. Also lstrip/rstrip(). ``` ```python = .split() # Splits it on one or more whitespace characters. = .split(sep=None, maxsplit=-1) # Splits on 'sep' string at most 'maxsplit' times. = .splitlines(keepends=False) # On [\n\r\f\v\x1c-\x1e\x85\u2028\u2029] and \r\n. = .join() # Joins items by using the string as a separator. ``` ```python = in # Returns True if string contains the substring. = .startswith() # Pass tuple of strings to give multiple options. = .find() # Returns start index of the first match or `-1`. ``` ```python = .lower() # Lowers the case. Also upper/capitalize/title(). = .casefold() # Lower() that converts ẞ/ß to ss, Σ/ς to σ, etc. = .replace(old, new [, count]) # Replaces 'old' with 'new' at most 'count' times. = .translate(table) # Use `str.maketrans()` to generate table. ``` ```python = chr() # Converts passed integer into Unicode character. = ord() # Converts passed Unicode character into integer. ``` * **Use `'unicodedata.normalize("NFC", )'` on strings like `'Motörhead'` before comparing them to other strings, because `'ö'` can be stored as one or two characters.** * **`'NFC'` converts such characters to a single character, while `'NFD'` converts them to two.** ```python = .isdecimal() # Checks all chars for [0-9]. Also [०-९], [٠-٩]. = .isdigit() # Checks for [²³¹…] and isdecimal(). Also [፩-፱]. = .isnumeric() # Checks for [¼½¾…] and isdigit(). Also [零〇一…]. = .isalnum() # Checks for [ABC…] and isnumeric(). Also [ªµº…]. = .isprintable() # Checks for [ !"#…], basic emojis and isalnum(). = .isspace() # Checks for [ \t\n\r\f\v\x1c\x1d\x1e\x1f\x85…]. ``` Regex ----- **Functions for regular expression matching.** ```python import re = re.sub(r'', new, text) # Substitutes occurrences with string 'new'. = re.findall(r'', text) # Returns all occurrences as string objects. = re.split(r'', text) # Add brackets around regex to keep matches. = re.search(r'', text) # Returns first occ. of the pattern or None. = re.match(r'', text) # Only searches at the start of the 'text'. = re.finditer(r'', text) # Returns all occurrences as Match objects. ``` * **Raw string literals do not interpret escape sequences, thus enabling us to use the regex-specific escape sequences that cause SyntaxWarning in normal string literals (since 3.12).** * **Argument `'new'` can also be a function that accepts a Match object and returns a string.** * **Argument `'flags=re.IGNORECASE'` can be used with all functions that are listed above.** * **Argument `'flags=re.MULTILINE'` makes `'^'` and `'$'` match the start/end of each line.** * **Argument `'flags=re.DOTALL'` makes `'.'` also accept the `'\n'` (besides all other chars).** * **`'re.compile(r"")'` returns a Pattern object with methods sub(), findall(), etc.** ### Match Object ```python = .group() # Returns the whole match. Also group(0). = .group(1) # Returns part inside the first brackets. = .groups() # Returns all bracketed parts as strings. = .start() # Returns start index of the whole match. = .end() # Returns the match's end index plus one. ``` ### Special Sequences ```python '\d' == '[0-9]' # Also [०-९…]. Matches decimal character. '\w' == '[a-zA-Z0-9_]' # Also [ª²³…]. Matches alphanumeric or _. '\s' == '[ \t\n\r\f\v]' # Also [\x1c-\x1f…]. Matches whitespace. ``` * **By default, decimal characters and alphanumerics from all alphabets are matched unless `'flags=re.ASCII'` is used. It restricts special sequence matches to the first 128 Unicode characters and also prevents `'\s'` from accepting `'\x1c'`, `'\x1d'`, `'\x1e'` and `'\x1f'` (non-printable characters that divide text into files, tables, rows and fields, respectively).** * **Use a capital letter, i.e. `'\D'`, `'\W'` or `'\S'`, for negation. All non-ASCII characters are matched if ASCII flag is used in conjunction with a capital letter.** Format ------ ```perl = f'{}, {}' # Curly brackets can contain any expression. = '{}, {}'.format(, ) # Same as '{0}, {a}'.format(, a=). = '%s, %s' % (, ) # Redundant and inferior C-style formatting. ``` ### Example ```python >>> Person = collections.namedtuple('Person', 'name height') >>> person = Person('Jean-Luc', 187) >>> f'{person.name} is {person.height / 100} meters tall.' 'Jean-Luc is 1.87 meters tall.' ``` ### General Options ```python {:<10} # ' '. {:^10} # ' '. {:>10} # ' '. {:.<10} # '.....'. {:0} # ''. ``` * **Objects are converted to strings with format() function, e.g. `'format(, "<10")'`.** * **Options can be generated dynamically via nested braces: `f'{:{}[…]}'`.** * **Adding `'='` to the expression prepends it to its result, e.g. `f'{1+1=}'` returns `'1+1=2'`.** * **Adding `'!r'` to the expression first calls result's [repr()](#class) method and only then format().** ### Strings ```python {'abcde':10} # 'abcde '. {'abcde':10.3} # 'abc '. {'abcde':.3} # 'abc'. {'abcde'!r:10} # "'abcde' ". ``` ### Numbers ```python {123456:10} # ' 123456'. {123456:10,} # ' 123,456'. {123456:10_} # ' 123_456'. {123456:+10} # ' +123456'. {123456:=+10} # '+ 123456'. {123456: } # ' 123456'. {-123456: } # '-123456'. ``` ### Floats ```python {1.23456:10.3} # ' 1.23'. {1.23456:10.3f} # ' 1.235'. {1.23456:10.3e} # ' 1.235e+00'. {1.23456:10.3%} # ' 123.456%'. ``` #### Comparison of presentation types: ```text +--------------+----------------+----------------+----------------+----------------+ | | {} | {:f} | {:e} | {:%} | +--------------+----------------+----------------+----------------+----------------+ | 0.000056789 | '5.6789e-05' | '0.000057' | '5.678900e-05' | '0.005679%' | | 0.00056789 | '0.00056789' | '0.000568' | '5.678900e-04' | '0.056789%' | | 0.0056789 | '0.0056789' | '0.005679' | '5.678900e-03' | '0.567890%' | | 0.056789 | '0.056789' | '0.056789' | '5.678900e-02' | '5.678900%' | | 0.56789 | '0.56789' | '0.567890' | '5.678900e-01' | '56.789000%' | | 5.6789 | '5.6789' | '5.678900' | '5.678900e+00' | '567.890000%' | | 56.789 | '56.789' | '56.789000' | '5.678900e+01' | '5678.900000%' | +--------------+----------------+----------------+----------------+----------------+ ``` ```text +--------------+----------------+----------------+----------------+----------------+ | | {:.2} | {:.2f} | {:.2e} | {:.2%} | +--------------+----------------+----------------+----------------+----------------+ | 0.000056789 | '5.7e-05' | '0.00' | '5.68e-05' | '0.01%' | | 0.00056789 | '0.00057' | '0.00' | '5.68e-04' | '0.06%' | | 0.0056789 | '0.0057' | '0.01' | '5.68e-03' | '0.57%' | | 0.056789 | '0.057' | '0.06' | '5.68e-02' | '5.68%' | | 0.56789 | '0.57' | '0.57' | '5.68e-01' | '56.79%' | | 5.6789 | '5.7' | '5.68' | '5.68e+00' | '567.89%' | | 56.789 | '5.7e+01' | '56.79' | '5.68e+01' | '5678.90%' | +--------------+----------------+----------------+----------------+----------------+ ``` * **`'{:g}'` is `'{:.6}'` that strips `'.0'` and has exponent starting at `'1e+06'`.** * **When both rounding up and rounding down are possible, the one that returns result with even last digit is chosen. Hence `'{6.5:.0f}'` becomes a `'6'`, while `'{7.5:.0f}'` an `'8'`.** * **The last rule only effects numbers that can be represented exactly by a float (`.5`, `.25`, …).** ### Ints ```python {90:c} # Converts 90 to Unicode character 'Z'. {90:b} # Converts 90 to binary number '1011010'. {90:X} # Converts 90 to hexadecimal number '5A'. ``` Numbers ------- ```python = int() # A whole number. Truncates floats. = float() # 64-bit decimal. Also . = complex(real=0, imag=0) # Complex number. Also ± j. = fractions.Fraction(numer, denom) # ` = / `. = decimal.Decimal() # `Decimal((1, (2,), 3)) == -2000`. ``` * **`'int()'` and `'float()'` raise ValueError exception if string is malformed.** * **Decimal objects store numbers exactly, unlike most floats where `'1.1 + 2.2 != 3.3'`.** * **Floats can be compared with: `'math.isclose(, , rel_tol=1e-9)'`.** * **Precision of decimal operations is set with: `'decimal.getcontext().prec = '`.** * **Bools can be used anywhere ints can, since bool is a subclass of int: `'True + 1 == 2'`.** ### Built-in Functions ```python = pow(, ) # E.g. `pow(3, 4) == 3 ** 4 == 81`. = abs() # E.g. `abs(-50) == abs(50) == 50`. = round( [, ±ndigits]) # E.g. `round(123.45, -1) == 120`. = min() # Also `max(, [, ...])`. = sum() # Also `math.prod()`. ``` ### Math ```python from math import floor, ceil, trunc # Funcs that convert float into int. from math import pi, inf, nan, isnan # `inf*0` and `nan+1` return `nan`. from math import sqrt, factorial # `sqrt(-1)` will raise ValueError. from math import sin, cos, tan # Also: degrees, radians, asin, etc. from math import log, log10, log2 # Log() can accept 'base' argument. ``` ### Statistics ```python from statistics import mean, median, mode # Mode returns most common element. from statistics import variance, stdev # Also `cuts = quantiles(data, n)`. ``` ### Random ```python from random import random, randint, uniform # Also: gauss, choice, shuffle, etc. ``` ```python = random() # Selects random float from [0, 1). = randint/uniform(a, b) # Selects an int/float from [a, b]. = gauss(mean, stdev) # Also triangular(low, high, mode). = choice() # Doesn't modify. Also sample(p, n). shuffle() # Works with all mutable sequences. ``` ### Hexadecimal Numbers ```python = 0x # E.g. `0xFf == 255`. Also 0b. = int('±', 16) # Also int('±0x/±0b', 0). = hex() # Returns '[-]0x'. Also bin(). ``` ### Bitwise Operators ```python = & # E.g. `0b1100 & 0b1010 == 0b1000`. = | # E.g. `0b1100 | 0b1010 == 0b1110`. = ^ # E.g. `0b1100 ^ 0b1010 == 0b0110`. = << n_bits # E.g. `0b1111 << 4 == 0b11110000`. = ~ # E.g. `~0b1 == -(0b1+1) == -0b10`. ``` Combinatorics ------------- ```python import itertools as it ``` ```python >>> list(it.product('abc', repeat=2)) # a b c [('a', 'a'), ('a', 'b'), ('a', 'c'), # a x x x ('b', 'a'), ('b', 'b'), ('b', 'c'), # b x x x ('c', 'a'), ('c', 'b'), ('c', 'c')] # c x x x ``` ```python >>> list(it.permutations('abc', 2)) # a b c [('a', 'b'), ('a', 'c'), # a . x x ('b', 'a'), ('b', 'c'), # b x . x ('c', 'a'), ('c', 'b')] # c x x . ``` ```python >>> list(it.combinations('abc', 2)) # a b c [('a', 'b'), ('a', 'c'), # a . x x ('b', 'c') # b . . x ] # c . . . ``` Datetime -------- **Provides 'date', 'time', 'datetime' and 'timedelta' classes. All are immutable and hashable.** ```python # $ pip3 install python-dateutil from datetime import date, time, datetime, timedelta, timezone import zoneinfo, dateutil.tz ``` ```python = date(year, month, day) # Only accepts valid dates between AD 1 and 9999. = time(hour=0, minute=0, second=0) # Accepts `microsecond=0, tzinfo=None, fold=0`.
= datetime(year, month, day, hour=0) # Accepts `minute=0, second=0, microsecond=0, …`. = timedelta(weeks=0, days=0, hours=0) # Accepts `minutes=0, seconds=0, microseconds=0`. ``` * **Times and datetimes that have defined timezone are called aware and ones that don't, naive. If time or datetime object is naive, it is presumed to be in the system's timezone.** * **`'fold=1'` means the second pass in case of time jumping back (usually for one hour).** * **Timedelta normalizes arguments to ±days, seconds (< 86 400) and microseconds (< 1M). Its str() method returns `'[±D, ]H:MM:SS[.…]'` and total_seconds() a float of seconds.** * **Use `'.weekday()'` to get the day of the week as an int (with Monday being 0).** ### Now ```python = D/DT.today() # Current local date or naive DT. Also DT.now(). = DT.now() # Aware DT from current time in passed timezone. ``` * **To extract time use `'.time()'`, `'.time()'` or `'.timetz()'`.** ### Timezones ```python = timezone.utc # Coordinated universal time. London without DST. = timezone() # Timezone with fixed offset from universal time. = dateutil.tz.tzlocal() # Local timezone with dynamic offset from the UTC. = zoneinfo.ZoneInfo('') # 'Continent/City_Name' zone with dynamic offset. =
.astimezone([]) # Converts DT to the passed or local fixed zone. = .replace(tzinfo=) # Changes the timezone object without conversion. ``` * **Timezones returned by tzlocal(), ZoneInfo(), and implicit local timezone of naive objects have offsets that vary through time due to DST and historical changes of the base offset.** * **To get ZoneInfo() to work on Windows run `'> pip3 install tzdata'`.** ### Encode ```python = D/T/DT.fromisoformat() # Object from the ISO string. Raises ValueError.
= DT.strptime(, '') # Naive or aware datetime from the custom string. = D/DT.fromordinal() # Date or DT from days since the Gregorian NYE 1. = DT.fromtimestamp() # A local naive DT from seconds since the epoch. = DT.fromtimestamp(, ) # An aware datetime from seconds since the epoch. ``` * **ISO strings come in following forms: `'YYYY-MM-DD'`, `'HH:MM:SS.mmmuuu[±HH:MM]'`, or both separated by an arbitrary character. All parts following the hours are optional.** * **Python uses the Unix epoch: `'1970-01-01 00:00 UTC'`, `'1970-01-01 01:00 CET'`, ...** ### Decode ```python = .isoformat(sep='T') # Also `timespec='auto/hours/minutes/seconds/…'`. = .strftime('') # Returns custom string representation of object. = .toordinal() # Days since NYE 1, ignoring DT's time and zone. = .timestamp() # Seconds since the epoch from a local naive DT. = .timestamp() # Seconds since the epoch from an aware datetime. ``` ### Format ```python >>> dta = datetime.strptime('2025-08-14 23:39:00.00 +0200', '%Y-%m-%d %H:%M:%S.%f %z') >>> dta.strftime("%dth of %B '%y (%a), %I:%M %p %Z") "14th of August '25 (Thu), 11:39 PM UTC+02:00" ``` * **`'%z'` accepts `'±HH[:]MM'` and returns `'±HHMM'` or empty string if object is naive.** * **`'%Z'` accepts `'UTC/GMT'` and local timezone's code and returns timezone's name, `'UTC[±HH:MM]'` if timezone is nameless, or an empty string if object is naive.** ### Arithmetics ```python = > # Ignores time jumps (fold attribute). Also `==`. = > # Ignores time jumps if they share tzinfo object. = - # Ignores jumps. Convert to UTC for actual delta. = - # Ignores jumps if they share the tzinfo object. = ± # Returned datetime can fall into a missing hour. = * # Also ` = ± `, ` = abs()`. = / # Calling divmod(, ) returns int and TD. ``` Function -------- **Independent block of code that returns a value when called.** ```python def (): ... # E.g. `func(x, y):`. def (): ... # E.g. `func(x=0, y=0):`. def (, ): ... # E.g. `func(x, y=0):`. ``` * **Function returns None if it doesn't encounter the `'return '` statement.** * **Run `'global '` inside the function before assigning to the global variable.** * **Value of a default argument is evaluated when function is first encountered in the scope.** * **Any mutation of a default argument value will persist between function invocations!** ### Function Call ```python = () # E.g. `func(0, 0)`. = () # E.g. `func(x=0, y=0)`. = (, ) # E.g. `func(0, y=0)`. ``` Splat Operator -------------- **Splat expands a collection into positional arguments, while splatty-splat expands a dictionary into keyword arguments.** ```python args, kwargs = (1, 2), {'z': 3} func(*args, **kwargs) ``` #### Is the same as: ```python func(1, 2, z=3) ``` ### Inside Function Definition **Splat combines zero or more positional arguments into a tuple, while splatty-splat combines zero or more keyword arguments into a dictionary.** ```python def add(*a): return sum(a) ``` ```python >>> add(1, 2, 3) 6 ``` #### Allowed compositions of arguments and the ways they can be called: ```text +---------------------------+----------------+--------------+--------------+ | | func(x=1, y=2) | func(1, y=2) | func(1, 2) | +---------------------------+----------------+--------------+--------------+ | func(x, *args, **kwargs): | yes | yes | yes | | func(*args, y, **kwargs): | yes | yes | | | func(*, x, **kwargs): | yes | | | +---------------------------+----------------+--------------+--------------+ ``` ### Other Uses ```python = [* [, ...]] # Same as `list() [+ ...]`. = (*, [...]) # Same as `tuple() [+ ...]`. = {* [, ...]} # Same as `set() [| ...]`. = {** [, ...]} # Last dict has priority. Also |. ``` ```python head, *body, tail = # Head or tail can be omitted. ``` Inline ------ ### Lambda ```python = lambda: # A single statement function. = lambda , : # Also allows default arguments. ``` ### Comprehensions ```python = [i+1 for i in range(5)] # Returns `[1, 2, 3, 4, 5]`. = (i for i in range(10) if i > 5) # Returns `iter([6, 7, 8, 9])`. = {i+5 for i in range(5)} # Returns `{5, 6, 7, 8, 9}`. = {i: i**2 for i in range(1, 4)} # Returns `{1: 1, 2: 4, 3: 9}`. ``` ```python >>> [l+r for l in 'abc' for r in 'abc'] # Inner loop is on right side. ['aa', 'ab', 'ac', ..., 'cc'] ``` ### Map, Filter, Reduce ```python from functools import reduce ``` ```python = map(lambda x: x + 1, range(5)) # Returns `iter([1, 2, 3, 4, 5])`. = filter(lambda x: x > 5, range(10)) # Returns `iter([6, 7, 8, 9])`. = reduce(lambda out, x: out + x, range(5)) # Returns 10. Accepts 'initial'. ``` ### Any, All ```python = any() # Is bool() True for any el? = all() # Is it True for all (or empty)? ``` ### Conditional Expression ```python = if else # Evaluates only one expression. ``` ```python >>> [i if i else 'zero' for i in (0, 1, 2, 3)] # `any(['', [], None])` is False. ['zero', 1, 2, 3] ``` ### And, Or ```python = and [and ...] # Returns first false or last obj. = or [or ...] # Returns first true or last obj. ``` ### Walrus Operator ```python >>> [i for ch in '0123' if (i := int(ch)) > 0] # Assigns to var in mid-sentence. [1, 2, 3] ``` ### Named Tuple, Enum, Dataclass ```python from collections import namedtuple Point = namedtuple('Point', 'x y') # Creates tuple's subclass. point = Point(0, 0) # Returns its instance. from enum import Enum Direction = Enum('Direction', 'N E S W') # Creates an enumeration. direction = Direction.N # Returns its member. from dataclasses import make_dataclass Player = make_dataclass('Player', ['loc', 'dir']) # Creates a normal class. player = Player(point, direction) # Returns its instance. ``` Imports ------- **Mechanism that makes code in one file available to another file.** ```python import # Imports a built-in module or the '.py'. import # A built-in package or '/__init__.py'. import . # A package's module or '/.py'. from [.…] import # Imports a module, function, class or variable. ``` * **Package is a collection of modules, but it can also define its own functions, variables, etc. On a filesystem this corresponds to a directory of Python files with an optional init script.** * **`'import '` only exposes modules that are imported inside `'__init__.py'`.** * **Directory of the file that is passed to python command serves as the root of local imports.** * **Use relative imports, i.e. `'from .[…][[.…]] import '`, if project has scattered entry points. Another option is to install the whole project by moving its code into 'src' dir, adding ['pyproject.toml'](https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#basic-information) to its root, and running `'$ pip3 install -e .'`.** Closure ------- **We have/get a closure in Python when a nested function references a value of its enclosing function and then the enclosing function returns its nested function (any value that is ref­erenced from within multiple nested functions gets shared).** ```python def get_multiplier(a): def out(b): return a * b return out ``` ```python >>> multiply_by_3 = get_multiplier(3) >>> multiply_by_3(10) 30 ``` ### Partial ```python from functools import partial = partial( [, [, ...]]) ``` ```python >>> def multiply(a, b): ... return a * b >>> multiply_by_3 = partial(multiply, 3) >>> multiply_by_3(10) 30 ``` * **Partial is also useful in cases when a function needs to be passed as an argument because it enables us to set its arguments beforehand (`'collections.defaultdict()'`, `'iter(, to_exc)'` and `'dataclasses.field(default_factory=)'`).** ### Non-Local **If variable is being assigned to anywhere in the scope (i.e., body of a function), it is treated as a local variable unless it is declared `'global'` or `'nonlocal'` before its first usage.** ```python def get_counter(): i = 0 def out(): nonlocal i i += 1 return i return out ``` ```python >>> counter = get_counter() >>> counter(), counter(), counter() (1, 2, 3) ``` Decorator --------- **A decorator takes a function, adds some functionality and returns it. It can be any [callable](#callable), but is usually implemented as a function that returns a [closure](#closure).** ```python @decorator_name def function_that_gets_passed_to_decorator(): ... ``` ### Debugger Example **Decorator that prints function's name every time that function is called.** ```python from functools import wraps def debug(func): @wraps(func) def out(*args, **kwargs): print(func.__name__) return func(*args, **kwargs) return out @debug def add(x, y): return x + y ``` * **Wraps is a helper decorator that copies the metadata of the passed function (func) to the function it is decorating (out). Without it, `'add.__name__'` would return string `'out'`.** ### Cache **Decorator that stores return values. All arguments must be hashable.** ```python from functools import cache @cache def fibonacci(n): return n if n < 2 else fibonacci(n-2) + fibonacci(n-1) ``` * **Potential problem with cache is that it can grow indefinitely. To clear stored values run `'.cache_clear()'`, or use `'@lru_cache(maxsize=)'` decorator instead.** * **CPython interpreter limits recursion depth to 3000 by default. To increase this limit run `'sys.setrecursionlimit()'`.** ### Parametrized Decorator **Decorator that accepts arguments and returns a normal decorator.** ```python from functools import wraps def debug(print_result=False): def decorator(func): @wraps(func) def out(*args, **kwargs): result = func(*args, **kwargs) print(func.__name__, result if print_result else '') return result return out return decorator @debug(print_result=True) def add(x, y): return x + y ``` * **Using only `'@debug'` to decorate the add() function would not work here, because debug would then receive the add() function as a 'print_result' argument. Decorators can how­ever manually check if the argument they received is a function and act accordingly.** Class ----- **A template for creating user-defined objects.** ```python class MyClass: def __init__(self, a): self.a = a def __str__(self): return str(self.a) def __repr__(self): class_name = self.__class__.__name__ return f'{class_name}({self.a!r})' @classmethod def get_class_name(cls): return cls.__name__ ``` ```python >>> obj = MyClass(1) >>> obj.a, str(obj), repr(obj) (1, '1', 'MyClass(1)') ``` * **Methods whose names start and end with two underscores are called special methods. They are executed when object is passed to a built-in function or used as an operand. For example, `'print(a)'` calls `'a.__str__()'` and `'a + b'` calls `'a.__add__(b)'`.** * **Methods that are decorated with `'@staticmethod'` receive neither 'self' nor 'cls' arg.** * **Return value of str() special method should be readable and of repr() unambiguous.** * **All calls to str() special method are dispatched to repr() when only repr() is provided.** #### Expressions that call the str() special method: ```python f'{obj}' print(obj) logging.warning(obj) .writerow([obj]) ``` #### Expressions that call the repr() special method: ```python f'{obj!r}' print/str/repr([obj]) print/str/repr({obj: obj}) print/str/repr(MyDataClass(obj)) ``` ### Subclass * **Inheritance is a mechanism that enables a class to extend some other class (i.e. sub­class to extend its parent), and by doing so inherit all of its methods and attributes.** * **Subclass can then add its own methods and attributes or override inherited ones by reusing their names.** ```python class Person: def __init__(self, name): self.name = name def __repr__(self): return f'Person({self.name!r})' def __lt__(self, other): return self.name < other.name class Employee(Person): def __init__(self, name, staff_num): super().__init__(name) self.staff_num = staff_num def __repr__(self): return f'Employee({self.name!r}, {self.staff_num})' ``` ```python >>> people = [Person('Bob'), Employee('Ann', 0)] >>> sorted(people) [Employee('Ann', 0), Person('Bob')] ``` ### Type Annotations * **They add type hints to variables, arguments and functions (`'def f() -> :'`).** * **Hints are used by type checkers like [mypy](https://pypi.org/project/mypy/), data validation libraries such as [Pydantic](https://pypi.org/project/pydantic/) and lately also by [Cython](https://pypi.org/project/Cython/) compiler. However, they are not enforced by CPython interpreter.** ```python from collections import abc : [| ...] [= ] : list/set/abc.Iterable/abc.Sequence[] [= ] : tuple/dict[, ...] [= ] ``` ### Dataclass **Decorator that uses class variables to generate init(), repr() and eq() special methods.** ```python from dataclasses import dataclass, field, make_dataclass @dataclass(order=False, frozen=False) class : : : = : list/dict/set = field(default_factory=list/dict/set) ``` * **Objects can be made [sortable](#sortable) with `'order=True'` and immutable with `'frozen=True'`.** * **For object to be [hashable](#hashable), all attributes must be hashable and `'frozen'` must be `'True'`.** * **Function field() is needed because `': list = []'` would make a list that is shared among all instances. Its 'default_factory' argument accepts any [callable](#callable) object.** * **For attributes/arguments of arbitrary type use `'typing.Any'`.** #### Inline: ```python P = make_dataclass('P', ['x', 'y']) P = make_dataclass('P', [('x', float), ('y', float)]) P = make_dataclass('P', [('x', float, 0), ('y', float, 0)]) ``` ### Property **Pythonic way of implementing getters and setters.** ```python class Person: @property def name(self): return ' '.join(self._name) @name.setter def name(self, value): self._name = value.split() ``` ```python >>> person = Person() >>> person.name = '\t Guido van Rossum \n' >>> person.name 'Guido van Rossum' ``` ### Slots **Mechanism that restricts objects to listed attributes.** ```python class Point: __slots__ = ['x', 'y'] ``` ### Copy ```python from copy import copy, deepcopy = copy/deepcopy() ``` Duck Types ---------- **A duck type is an implicit type that prescribes a set of special methods. Any object that has those methods defined is considered a member of that duck type.** ### Comparable * **If eq() method is not overridden, it returns `'id(self) == id(other)'`, which is the same as `'self is other'`. That means all user-defined objects compare not equal by default (because id() returns object's memory address that is guaranteed to be unique).** * **Only the left side object has eq() method called, unless it returns NotImplemented, in which case the right object is consulted. Result is False if both return NotImplemented.** * **Method ne() (called by `'!='`) automatically works on any object that has eq() defined.** ```python class MyComparable: def __init__(self, a): self.a = a def __eq__(self, other): if isinstance(other, type(self)): return self.a == other.a return NotImplemented ``` ### Hashable * **Hashable object needs hash() and eq() methods and its hash value must never change.** * **Hashable objects that compare equal must have the same hash value, meaning default hash() that returns `'id(self)'` will not do. That is why Python automatically makes classes unhashable if you only implement the eq() method.** ```python class MyHashable: def __init__(self, a): self._a = a @property def a(self): return self._a def __eq__(self, other): if isinstance(other, type(self)): return self.a == other.a return NotImplemented def __hash__(self): return hash(self.a) ``` ### Sortable * **With 'total_ordering' decorator, you only need to provide eq() and one of lt(), gt(), le() or ge() special methods (called by <, >, <=, >=) and the rest will be automatically generated.** * **Built-in functions sorted() and min() only require lt() method, while max() only requires gt(). However, it's best to define them all so that confusion doesn't arise in other contexts.** * **When two lists, strings, or data classes are compared, their values get compared one by one until a pair of unequal values is found. The comparison of this two values is then re­turned. The shorter sequence is considered smaller in case of all their values being equal.** * **To sort collection of strings in proper alphabetical order pass `'key=locale.strxfrm'` to sorted() after running `'locale.setlocale(locale.LC_COLLATE, "en_US.UTF-8")'`.** ```python from functools import total_ordering @total_ordering class MySortable: def __init__(self, a): self.a = a def __eq__(self, other): if isinstance(other, type(self)): return self.a == other.a return NotImplemented def __lt__(self, other): if isinstance(other, type(self)): return self.a < other.a return NotImplemented ``` ### Iterator * **Any object that has methods next() and iter() is an iterator.** * **Next() should return next item or raise StopIteration exception.** * **Iter() should return unmodified iterator, i.e. the 'self' argument.** * **Any object that has iter() method can be used in a for loop.** ```python class Counter: def __init__(self): self.i = 0 def __next__(self): self.i += 1 return self.i def __iter__(self): return self ``` ```python >>> counter = Counter() >>> next(counter), next(counter), next(counter) (1, 2, 3) ``` #### Python has many different iterator objects: * **Sequence iterators returned by the [iter()](#iterator) function, such as list\_iterator, etc.** * **Objects returned by the [itertools](#itertools) module, such as count, repeat and cycle.** * **Generators returned by the [generator functions](#generator) and [generator expressions](#comprehensions).** * **File objects returned by the [open()](#open) function, [SQLite](#sqlite) cursor objects, etc.** ### Callable * **All functions and classes have a call() method that is executed when they are called.** * **Use `'callable()'` or `'isinstance(, collections.abc.Callable)'` to check if object is callable. You can also call the object and see if it raised TypeError.** * **When this text uses `''` as an argument, it actually means `''`.** ```python class Counter: def __init__(self): self.i = 0 def __call__(self): self.i += 1 return self.i ``` ```python >>> counter = Counter() >>> counter(), counter(), counter() (1, 2, 3) ``` ### Context Manager * **With statements only work on objects that have enter() and exit() special methods.** * **Enter() should lock the resources and optionally return an object (file, socket, etc.).** * **Exit() should release the resources (for example close the file, release the lock, etc.).** * **Any exception that happens inside the with block is passed to exit() method. Exit() can then suppress this exception by returning a true value (not None, False, 0, etc.).** ```python class MyOpen: def __init__(self, filename): self.filename = filename def __enter__(self): self.file = open(self.filename) return self.file def __exit__(self, exc_type, exception, traceback): self.file.close() ``` ```python >>> with open('test.txt', 'w') as file: ... file.write('Hello World!') >>> with MyOpen('test.txt') as file: ... print(file.read()) Hello World! ``` Iterable Duck Types ------------------- ### Iterable * **Only required method is iter(). It should return an iterator of object's items.** * **Method contains() automatically works on any object that has iter() defined.** ```python class MyIterable: def __init__(self, a): self.a = a def __iter__(self): return iter(self.a) def __contains__(self, el): return el in self.a ``` ```python >>> obj = MyIterable([1, 2, 3]) >>> [el for el in obj] [1, 2, 3] >>> 1 in obj True ``` ### Collection * **Only required methods are iter() and len(). Len() should return the length of collection.** * **This text refers to all iterable objects as collections, which is technically incorrect. The term _iterable_ was avoided because it sounds scarier and more vague than _collection_. The main drawback of this decision is that the reader could think a certain function doesn't accept iterators when it actually does, since iterators are the only built-in objects that are iterable but are not collections.** ```python class MyCollection: def __init__(self, a): self.a = a def __iter__(self): return iter(self.a) def __contains__(self, el): return el in self.a def __len__(self): return len(self.a) ``` ### Sequence * **Only required methods are getitem() and len(). Getitem() should return an item at the passed index or raise IndexError (it may also support negative indices and/or slices).** * **Iter() and contains() automatically work on any object with defined getitem() method.** * **Reversed() automatically works on any object that has getitem() and len() defined. It returns reversed iterator of object's items.** ```python class MySequence: def __init__(self, a): self.a = a def __iter__(self): return iter(self.a) def __contains__(self, el): return el in self.a def __len__(self): return len(self.a) def __getitem__(self, i): return self.a[i] def __reversed__(self): return reversed(self.a) ``` #### Discrepancies between glossary definitions and abstract base classes: * **Python's glossary defines iterable as any object with special methods iter() or getitem(), and sequence as any object with getitem() and len(). It doesn't define the term _collection_.** * **Passing ABC Iterable to isinstance() or issubclass() only checks whether object/class has special method iter(), while ABC Collection checks for iter(), contains() and len().** ### ABC Sequence * **It's a richer interface than the basic sequence that also requires just getitem() and len().** * **Extending it generates iter(), contains(), reversed(), index() and count() special methods.** * **Unlike `'abc.Iterable'` and `'abc.Collection'`, it is not a duck type. That is why exp. `'issubclass(MySequence, abc.Sequence)'` would return False even if MySequence had all methods defined. It however recognizes list, tuple, range, string, bytes, bytearray, array, memoryview and deque, since they are registered as Sequence's virtual subclasses.** ```python from collections import abc class MyAbcSequence(abc.Sequence): def __init__(self, a): self.a = a def __len__(self): return len(self.a) def __getitem__(self, i): return self.a[i] ``` #### Table of required and automatically available special methods: ```text +------------+------------+------------+------------+--------------+ | | Iterable | Collection | Sequence | abc.Sequence | +------------+------------+------------+------------+--------------+ | iter() | REQ | REQ | Yes | Yes | | contains() | Yes | Yes | Yes | Yes | | len() | | REQ | REQ | REQ | | getitem() | | | REQ | REQ | | reversed() | | | Yes | Yes | | index() | | | | Yes | | count() | | | | Yes | +------------+------------+------------+------------+--------------+ ``` * **Method iter() is required for `'isinstance(, abc.Iterable)'` to return True, however any object with getitem() method works with any code expecting an iterable.** * **MutableSequence, Set, MutableSet, Mapping and MutableMapping ABCs are also ex­tendable. Use `'.__abstractmethods__'` to get names of required methods.** Enum ---- **Class of named constants called members.** ```python from enum import Enum, auto ``` ```python class (Enum): = auto() # An increment of last numeric value or 1. = # Values don't have to be hashable/unique. = , # Value can be a collection, e.g. a tuple. ``` * **Methods receive the member they were called on as the 'self' argument.** * **Accessing a member named after a reserved keyword causes SyntaxError.** ```python = . # Accesses a member via enum's attribute. = [''] # Returns the member or raises KeyError. = () # Returns the member or raises ValueError. = .name # Returns the member's name as a string. = .value # Value can't be a user-defined function. ``` ```python = list() # Returns a list containing every member. = ._member_names_ # Returns a list containing member names. = [m.value for m in ] # Returns a list containing member values. ``` ```python = type() # Returns an enum. Also .__class__. = itertools.cycle() # Returns an endless iterator of members. = random.choice(list()) # Randomly selects one of enum's members. ``` ### Inline ```python Cutlery = Enum('Cutlery', 'FORK KNIFE SPOON') Cutlery = Enum('Cutlery', ['FORK', 'KNIFE', 'SPOON']) Cutlery = Enum('Cutlery', {'FORK': 1, 'KNIFE': 2, 'SPOON': 3}) ``` #### User-defined functions cannot be values, so they must be wrapped: ```python from functools import partial LogicOp = Enum('LogicOp', {'AND': partial(lambda l, r: l and r), 'OR': partial(lambda l, r: l or r)}) ``` Exceptions ---------- ```python try: except : ``` ### Complex Example ```python try: except : except : else: finally: ``` * **Code inside the `'else'` block will only be executed if `'try'` block had no exceptions.** * **Code inside the `'finally'` block will always be executed (unless a signal is received).** * **All variables that are initialized in executed blocks are also visible in all subsequent blocks, as well as outside the try statement (only the function block delimits scope).** * **To catch signals use `'signal.signal(signal_number, my_handler_function)'`.** ### Catching Exceptions ```python except : ... except as : ... except (, [...]): ... except (, [...]) as : ... ``` * **It also catches subclasses, e.g. `'ArithmeticError'` is caught by `'except Exception:'`.** * **Use `'traceback.print_exc()'` to print the full error message to standard error stream.** * **Use `'print()'` to print just the cause of the exception (its arguments) to stdout.** * **Use `'logging.exception()'` to log the passed message, followed by the full error message of the caught exception. For details about how to set up the logger see [Logging](#logging).** * **`'sys.exc_info()'` returns type, object and traceback of the caught exception as a tuple.** ### Raising Exceptions ```python raise raise () raise ( [, ...]) ``` #### Re-raising caught exception: ```python except [as ]: ... raise ``` ### Exception Object ```python arguments = .args exc_type = .__class__ filename = .__traceback__.tb_frame.f_code.co_filename func_name = .__traceback__.tb_frame.f_code.co_name line_str = linecache.getline(filename, .__traceback__.tb_lineno) trace_str = ''.join(traceback.format_tb(.__traceback__)) error_msg = ''.join(traceback.format_exception(*sys.exc_info())) ``` ### Built-in Exceptions ```text BaseException +-- SystemExit # Raised when `sys.exit()` is called. See #Exit for details. +-- KeyboardInterrupt # Raised when the user hits the interrupt key, i.e. `ctrl-c`. +-- Exception # User-defined exceptions should be derived from this class. +-- ArithmeticError # Base class for arithmetic errors such as ZeroDivisionError. +-- AssertionError # Raised by `assert ` if expression returns false value. +-- AttributeError # Raised when object doesn't have requested attribute/method. +-- EOFError # Raised by `input()` when it hits an end-of-file condition. +-- LookupError # Base class for errors when a collection can't find an item. | +-- IndexError # Raised when index of a sequence (list/str) is out of range. | +-- KeyError # Raised when a dictionary's key or a set element is missing. +-- MemoryError # Out of memory. May be too late to start deleting variables. +-- NameError # Raised when nonexistent name (variable/func/class) is used. | +-- UnboundLocalError # Raised when a local name is used before it's being defined. +-- OSError # Errors such as FileExistsError and TimeoutError. See #Open. | +-- ConnectionError # Errors such as BrokenPipeError and ConnectionAbortedError. +-- RuntimeError # Is raised by errors that do not fit into other categories. | +-- NotImplementedEr… # Can be raised by abstract methods or by an unfinished code. | +-- RecursionError # Raised if max recursion depth is exceeded (3k by default). +-- StopIteration # Raised when exhausted (empty) iterator is passed to next(). +-- TypeError # Raised when argument of wrong type is passed to a function. +-- ValueError # Raised when it has the right type but inappropriate value. ``` #### Collections and their exceptions: ```text +-----------+------------+------------+------------+ | | List | Set | Dict | +-----------+------------+------------+------------+ | getitem() | IndexError | | KeyError | | pop() | IndexError | KeyError | KeyError | | remove() | ValueError | KeyError | | | index() | ValueError | | | +-----------+------------+------------+------------+ ``` #### Useful built-in exceptions: ```python raise TypeError('Function received argument of the wrong type!') raise ValueError('Argument has the right type but its value is off!') raise RuntimeError('I am too lazy to define my own exception!') ``` ### User-defined Exceptions ```python class MyError(Exception): pass class MyInputError(MyError): pass ``` Exit ---- **Exits the interpreter by raising SystemExit exception.** ```python import sys sys.exit() # Exits with exit code 0 (success). sys.exit() # Exits with the passed exit code. sys.exit() # Prints to stderr and exits with 1. ``` Print ----- ```python print(, ..., sep=' ', end='\n', file=sys.stdout, flush=False) ``` * **Use `'file=sys.stderr'` or `'sys.stderr.write()'` for messages about errors.** * **Stdout and stderr streams hold output in a buffer until they receive a string containing '\n' or '\r', buffer reaches 4096 characters, `'flush=True'` is used, or the program exits.** ### Pretty Print ```python from pprint import pprint pprint(, width=80, depth=None, compact=False, sort_dicts=True) ``` * **Each item is printed on its own line if collection exceeds 'width' characters.** * **Nested collections that are `'depth='` levels deep get printed as `'...'`.** Input ----- ```python = input() ``` * **Reads a line from the user input or pipe if present (trailing newline gets stripped).** * **If argument is passed, it gets printed to the standard output before input is read.** * **EOFError is raised if user hits EOF (ctrl-d/ctrl-z⏎) or stream is already exhausted.** Command Line Arguments ---------------------- ```python import sys scripts_path = sys.argv[0] arguments = sys.argv[1:] ``` ### Argument Parser ```python from argparse import ArgumentParser p = ArgumentParser(description=) # Also accepts 'usage' str. p.add_argument('-', '--', action='store_true') # Flag (defaults to False). p.add_argument('-', '--', type=) # Option (defaults to None). p.add_argument('', type=, nargs=1) # Mandatory first argument. p.add_argument('', type=, nargs='+') # Mandatory remaining args. p.add_argument('', type=, nargs='?') # Optional argument. Also *. args = p.parse_args() # Exits on a parsing error. = args. # Returns `()`. ``` * **Use `'help='` to set argument description that is used by `'-h'`.** * **Use `'default='` to set option's or argument's default value.** Open ---- **Opens a file and returns the corresponding file object.** ```python = open(, mode='r', encoding=None, newline=None) ``` * **`'encoding=None'` means that a default encoding is used, which is platform dependent. Best practice is to use `'encoding="utf-8"'` until it becomes the default (Python 3.15).** * **`'newline=None'` means that all different end of line combinations are converted to '\n' on read, while on write all '\n' characters are converted to the system's default separator.** * **`'newline=""'` means no conversions take place, but input is still broken into chunks by readline() on every '\n', '\r' and '\r\n'. Passing `'newline="\n"'` breaks input only on '\n'.** * **`'newline="\r\n"'` breaks input only on '\r\n' and converts every '\n' to '\r\n' on write.** ### Modes * **`'r'` - Reads text from the file (the default option).** * **`'w'` - Writes to the file. Deletes existing contents.** * **`'x'` - Writes or raises FileExistsError if file exists.** * **`'a'` - Appends. Creates new file if it doesn't exist.** * **`'w+'` - Reads and writes. Deletes existing contents.** * **`'r+'` - Reads and writes from the start of the file.** * **`'a+'` - Reads and writes from the end of the file.** * **`'rb'` - Reads [bytes objects](#bytes). Also `'wb'`, `'xb'`, etc.** ### Exceptions * **`'FileNotFoundError'` can be raised when reading with `'r'` or `'r+'`.** * **`'FileExistsError'` exception can be raised when writing with `'x'`.** * **`'IsADirectoryError'`, `'PermissionError'` can be raised by any.** * **`'except OSError [as ]: …'` catches all listed exceptions.** ### File Object ```python .seek(0) # Moves current position to the file's start. .seek(offset) # Moves 'offset' chars/bytes from the start. .seek(0, 2) # Moves current position to the end of file. .seek(±offset, origin) # Origin: 0 start, 1 current position, 2 end. ``` ```python = .read(size=-1) # Reads 'size' chars/bytes or until the EOF. = .readline() # Returns a line or empty string/bytes on EOF. = .readlines() # Returns remaining lines. Also list(). = next() # Returns a line using the read-ahead buffer. ``` ```python .write() # Writes str or bytes object to write buffer. .writelines() # Writes a coll. of strings or bytes objects. .flush() # Flushes write buff. Runs every 4096/8192 B. .close() # Closes a file after flushing write buffer. ``` * **Methods do not add or strip trailing newlines, not even writelines().** ### Read Text from File ```python def read_file(filename): with open(filename, encoding='utf-8') as file: return file.readlines() ``` ### Write Text to File ```python def write_to_file(filename, text): with open(filename, 'w', encoding='utf-8') as file: file.write(text) ``` Paths ----- ```python import os, glob from pathlib import Path ``` ```python = os.getcwd() # Returns working dir. Starts as shell's `$PWD`. = os.path.join(, ...) # Uses `os.sep` to join strings or Path objects. = os.path.realpath() # Resolves symlinks and calls os.path.abspath(). ``` ```python = os.path.basename() # Returns final component (filename or dirname). = os.path.dirname() # Returns the path without its final component. = os.path.splitext() # Splits on last period of the final component. ``` ```python = os.listdir(path='.') # Returns all file/dir names located at 'path'. = glob.glob('') # Returns paths matching the wildcard pattern. ``` ```python = os.path.exists() # Checks if path exists. Also .exists(). = os.path.isfile() # Also .is_file(), .is_file(). = os.path.isdir() # Also .is_dir() and .is_dir(). ``` ```python = os.stat() # A status object. Also .stat(). = .st_size/st_mtime/… # Returns size in bytes, modification time, ... ``` ### DirEntry **Unlike listdir(), scandir() returns DirEntry objects that cache isfile, isdir, and on Windows also stat information, thus significantly increasing the performance of code that requires it.** ```python = os.scandir(path='.') # Returns DirEntry objects located at the path. = .path # Is absolute if 'path' argument was absolute. = .name # Returns the path's final component as string. = open() # Opens the file and returns its file object. ``` ### Path Object ```python = Path( [, ...]) # Accepts strings, Paths, and DirEntry objects. = / [/ ...] # First or second object must be a Path object. = .resolve() # Returns absolute path with resolved symlinks. ``` ```python = Path() # Returns current working dir. Also Path('.'). = Path.cwd() # Returns absolute CWD. Also Path().resolve(). = Path.home() # Returns the user's absolute home directory. = Path(__file__).resolve() # Returns module's path if CWD wasn't changed. ``` ```python = .parent # Returns the path without its final component. = .name # Returns final component (i.e. file/dirname). = .suffix # Returns the name's last extension with a dot. = .stem # Returns the name without its last extension. = .parts # Starts with '/' or 'C:\' if path is absolute. ``` ```python = .iterdir() # Returns directory contents as Path objects. = .glob('') # Returns Paths matching the wildcard pattern. ``` ```python = str() # Returns path as string. Also .as_uri(). = open() # Also .read_text/write_bytes/…(). ``` OS Commands ----------- ```python import os, shutil ``` ```python os.chdir() # Changes the current working directory (or CWD). os.mkdir(, mode=0o777) # Creates a directory. Permissions are in octal. os.makedirs(, mode=0o777) # Creates all path's dirs. Also `exist_ok=False`. ``` ```python shutil.copy(from, to) # Copies the file ('to' can exist or be a dir). shutil.copy2(from, to) # Also copies the creation and modification time. shutil.copytree(from, to) # Copies the directory ('to' should not exist). ``` ```python os.rename(from, to) # Renames or moves the file or directory 'from'. os.replace(from, to) # Same, but overwrites file 'to' even on Windows. shutil.move(from, to) # `rename()` that moves into 'to' if it's a dir. ``` ```python os.remove() # Deletes file. Also `$ pip3 install send2trash`. os.rmdir() # Deletes empty dir. Raises OSError if it's not. shutil.rmtree() # Deletes the directory and all of its contents. ``` * **Passed paths can be either strings, Path objects, or DirEntry objects.** * **Functions report errors by raising OSError or one of its [subclasses](#exceptions-1).** Shell Commands -------------- ```python import os, subprocess, shlex ``` ```python = os.system('') # Runs commands in sh/cmd shell. Prints results. = subprocess.run('') # For arguments see examples. Prints by default. = os.popen('') # Prints only stderr. Soft deprecated since 3.14. = .read(size=-1) # Returns combined stdout. Provides readline/s(). = .close() # Returns None if last command had returncode 0. ``` #### Sends "1 + 1" to the basic calculator and captures its stdout and stderr streams: ```python >>> subprocess.run('bc', input='1 + 1\n', capture_output=True, text=True) CompletedProcess(args='bc', returncode=0, stdout='2\n', stderr='') ``` #### Sends test.in to the 'bc' running in standard mode and saves its stdout to test.out: ```python >>> if os.system('echo 1 + 1 > test.in') == 0: ... with open('test.in') as file_in, open('test.out', 'w') as file_out: ... subprocess.run(shlex.split('bc -s'), stdin=file_in, stdout=file_out) ... print(open('test.out').read()) 2 ``` JSON ---- ```python import json = json.dumps() # Converts collection to JSON string. = json.loads() # Converts JSON string to collection. ``` ### Read Collection from JSON File ```python def read_json_file(filename): with open(filename, encoding='utf-8') as file: return json.load(file) ``` ### Write Collection to JSON File ```python def write_to_json_file(filename, collection): with open(filename, 'w', encoding='utf-8') as file: json.dump(collection, file, ensure_ascii=False, indent=2) ``` Pickle ------ ```python import pickle = pickle.dumps() # Converts object to bytes object. = pickle.loads() # Converts bytes object to object. ``` ### Read Object from Pickle File ```python def read_pickle_file(filename): with open(filename, 'rb') as file: return pickle.load(file) ``` ### Write Object to Pickle File ```python def write_to_pickle_file(filename, an_object): with open(filename, 'wb') as file: pickle.dump(an_object, file) ``` CSV --- **Text file format for storing spreadsheets.** ```python import csv ``` ```python = open(, newline='') # Opens the text file for reading. = csv.reader(, dialect='excel') # Also `delimiter=','`. See Params. = next() # Returns a row as list of strings. = list() # Returns a list of remaining rows. ``` * **Without the `'newline=""'` argument, every '\r\n' sequence that is embedded inside a quoted field will get converted to '\n'. For details about the newline argument see [Open](#open).** * **To nicely print the spreadsheet to the console use either [Tabulate](#table) or PrettyTable library.** * **For XML and binary Excel files (with extensions xlsx, xlsm and xlsb) use [Pandas](#file-formats) library.** * **Reader can consume any iterator or collection of strings, not just text files.** ### Write ```python = open(, mode='a', newline='') # Opens the text file for writing. = csv.writer(, dialect='excel') # Also `delimiter=','`. See Params. .writerow() # Encodes objects using str(). .writerows() # Appends rows to the opened file. ``` * **If file is opened without the `'newline=""'` argument, '\r' will be added in front of every '\n' on platforms that use '\r\n' line endings. I.e., newlines may get doubled on Windows.** * **Open existing file with `'mode="a"'` to append to it or `'mode="w"'` to overwrite it.** ### Parameters * **`'dialect'` - Master parameter that sets the default values. String or a _csv.Dialect_ object.** * **`'delimiter'` - A one-character string that separates fields. Comma, tab, semicolon, etc.** * **`'lineterminator'` - Sets how writer terminates rows. Reader looks for '\n', '\r' and '\r\n'.** * **`'quotechar'` - Character for quoting fields containing delimiters, quotechars, '\n' or '\r'.** * **`'escapechar'` - Character for escaping quotechars. Can be None if doublequote is True.** * **`'doublequote'` - Whether quotechars inside fields are/get doubled (instead of escaped).** * **`'quoting'` - 0: As necessary, 1: All, 2: All but numbers which are read as floats, 3: None.** * **`'skipinitialspace'` - Is space character at the start of the field stripped by the reader.** ### Dialects ```text +------------------+--------------+--------------+--------------+ | | excel | excel-tab | unix | +------------------+--------------+--------------+--------------+ | delimiter | ',' | '\t' | ',' | | lineterminator | '\r\n' | '\r\n' | '\n' | | quotechar | '"' | '"' | '"' | | escapechar | None | None | None | | doublequote | True | True | True | | quoting | 0 | 0 | 1 | | skipinitialspace | False | False | False | +------------------+--------------+--------------+--------------+ ``` ### Read Rows from CSV File ```python def read_csv_file(filename, **csv_params): with open(filename, encoding='utf-8', newline='') as file: return list(csv.reader(file, **csv_params)) ``` ### Write Rows to CSV File ```python def write_to_csv_file(filename, rows, mode='w', **csv_params): with open(filename, mode, encoding='utf-8', newline='') as file: writer = csv.writer(file, **csv_params) writer.writerows(rows) ``` SQLite ------ **A server-less database engine that stores each database into its own file.** ```python import sqlite3 = sqlite3.connect() # Opens existing or new file. Also ':memory:'. .close() # Closes connection. Discards uncommitted data. ``` ### Read ```python = .execute('SELECT …') # Can raise a subclass of the `sqlite3.Error`. = .fetchone() # Returns the next row. Also next(). = .fetchall() # Returns remaining rows. Also list(). ``` ### Write ```python .execute('INSERT …') # Can raise a subclass of the `sqlite3.Error`. .commit() # Saves all the changes since the last commit. .rollback() # Discards all changes since the last commit. ``` #### Or: ```python with : # Exits the block with commit() or rollback(), .execute('INSERT …') # depending on whether any exception occurred. ``` ### Placeholders ```python .execute('', ) # Replaces every question mark with its item. .execute('', ) # Replaces every : with a matching value. .executemany('', ) # Executes statement once for each collection. ``` * **Accepts strings, ints, floats, bytes, None objects, and bools (stored as 1 or 0).** * **Columns are not restricted to any type unless table is declared as strict.** ### Example **Values are not actually saved in this example because `'con.commit()'` is omitted!** ```python >>> con = sqlite3.connect('test.db') >>> con.execute('CREATE TABLE person (name TEXT, height INTEGER) STRICT') >>> con.execute('INSERT INTO person VALUES (?, ?)', ('Jean-Luc', 187)) >>> con.execute('SELECT rowid, * FROM person').fetchall() [(1, 'Jean-Luc', 187)] ``` ### SQLAlchemy **Library for interacting with various DB systems via SQL, [method chaining](https://docs.sqlalchemy.org/en/latest/tutorial/data_select.html#the-select-sql-expression-construct) or [ORM](https://docs.sqlalchemy.org/en/latest/orm/quickstart.html#simple-select).** ```python # $ pip3 install sqlalchemy from sqlalchemy import create_engine, text = create_engine('') # Url: 'dialect://user:password@host/dbname'. = .connect() # Creates new connection. Also .close(). = .execute(text('')) # Pass a dict to replace : placeholders. with .begin(): ... # Exits the block with a commit or rollback. ``` ```text +-----------------+--------------+----------------------------------+ | Dialect | pip3 install | Dependencies | +-----------------+--------------+----------------------------------+ | mysql | mysqlclient | www.pypi.org/project/mysqlclient | | postgresql | psycopg2 | www.pypi.org/project/psycopg2 | | mssql | pyodbc | www.pypi.org/project/pyodbc | | oracle+oracledb | oracledb | www.pypi.org/project/oracledb | +-----------------+--------------+----------------------------------+ ``` Bytes ----- **An immutable sequence of single bytes. Mutable version is called bytearray.** ```python = b'' # Accepts ASCII characters and \x00 to \xff. = [index] # Returns the byte as int between 0 and 255. = [] # Returns bytes even if it has one element. = .join() # Joins elements using bytes as a separator. ``` ### Encode ```python = bytes() # Passed integers must be between 0 and 255. = bytes(, 'utf-8') # Encodes the string. Same as .encode(). = bytes.fromhex('') # Hex pairs can be separated by whitespaces. = .to_bytes(n_bytes) # Accepts `byteorder='little', signed=True`. ``` ### Decode ```python = list() # Returns a list of ints between 0 and 255. = str(, 'utf-8') # Returns a string. Same as .decode(). = .hex() # Returns hex pairs separated by `sep=`. = int.from_bytes() # Accepts `byteorder='little', signed=True`. ``` ### Read Bytes from File ```python def read_bytes(filename): with open(filename, 'rb') as file: return file.read() ``` ### Write Bytes to File ```python def write_bytes(filename, bytes_obj): with open(filename, 'wb') as file: file.write(bytes_obj) ``` Struct ------ * **Module that performs conversions between a sequence of numbers and a bytes object.** * **System’s type sizes, byte order, and alignment rules are used by default.** ```python from struct import pack, unpack = pack('', , ...) # Packs numbers according to format. = unpack('', ) # Use `iter_unpack()` to get tuples. ``` ```python >>> pack('>hhl', 1, 2, 3) b'\x00\x01\x00\x02\x00\x00\x00\x03' >>> unpack('bhh', b'\x01\x00\x02\x00\x03\x00') (1, 2, 3) ``` ### Format #### For standard type sizes and manual alignment (padding) start format string with: * **`'='` - System's byte order (usually little-endian).** * **`'<'` - Little-endian (i.e. least significant byte first).** * **`'>'` - Big-endian (also `'!'`).** #### Besides numbers, pack() and unpack() also support bytes objects as a part of the sequence: * **`'c'` - A bytes object with a single element. For pad byte use `'x'`.** * **`'s'` - A bytes object with n elements (not effected by byte order).** #### Integers. Use capital letter for unsigned type. Minimum/standard sizes are in brackets: * **`'b'` - char (1/1)** * **`'h'` - short (2/2)** * **`'i'` - int (2/4)** * **`'l'` - long (4/4)** * **`'q'` - long long (8/8)** #### Floating point types (struct always uses standard sizes): * **`'f'` - float (4/4)** * **`'d'` - double (8/8)** Array ----- **List that can only hold numbers that fit into the passed C type. Available types and their min­imum sizes in bytes are listed above. Type sizes and byte order are always determined by the system, how­ever bytes of each element can be reversed (by calling the byteswap() method).** ```python from array import array ``` ```python = array('' [, ]) # Creates array. Accepts collection of numbers. = array('', ) # Copies passed bytes into the array's memory. = array('', ) # Treats passed array as a sequence of numbers. .fromfile(, n_items) # Appends file contents to the array's memory. ``` ```python = bytes() # Returns copy of the memory as a bytes object. .write() # Appends the array's memory to a binary file. ``` Memory View ----------- **A sequence object that points to the memory of another bytes-like object. Each element can reference a single or multiple consecutive bytes, depending on format. Order and number of elements can be changed with slicing.** ```python = memoryview() # Returns mutable memoryview if array is passed. = [index] # Returns an int/float. Bytes if format is 'c'. = [] # Returns a memoryview with rearranged elements. = .cast('') # Only works between B/b/c and the other types. .release() # Releases the memory buffer of the base object. ``` ```python = bytes() # Returns a new bytes object. Also bytearray(). = .join() # Joins memoryviews using bytes as a separator. = array('', ) # Treats passed mview as a sequence of numbers. .write() # Appends `bytes()` to the binary file. ``` ```python = list() # Returns list of ints, floats or bytes objects. = str(, 'utf-8') # Treats passed memoryview as `bytes()`. = .hex() # Returns hex pairs separated with `sep=`. ``` Deque ----- **List with efficient appends and pops from either side.** ```python from collections import deque ``` ```python = deque() # Pass `maxlen=` to set the size limit. .appendleft() # Drops last element if maxlen is exceeded. .extendleft() # Prepends reversed collection to the deque. .rotate(n=1) # Moves last element to the start of deque. = .popleft() # Removes and returns deque's first element. ``` Operator -------- **Module of functions that provide the functionality of operators. Functions are grouped by operator precedence, from least to most binding. Functions and operators in first, third and fifth line are also ordered by precedence within a line.** ```python import operator as op ``` ```python = op.not_() # or, and, not (or/and missing). = op.eq/ne/lt/ge/is_/is_not/contains(, ) # ==, !=, <, >=, is, is not, in. = op.or_/xor/and_(, ) # |, ^, & (sorted by precedence). = op.lshift/rshift(, ) # <<, >> (i.e. << n_bits). = op.add/sub/mul/truediv/floordiv/mod(, ) # +, -, *, /, //, % (two groups). = op.neg/invert() # -, ~ (negate and bitwise not). = op.pow(, ) # ** (pow() accepts 3 arguments). = op.itemgetter/attrgetter/methodcaller( [, …]) # [index/key], .name, .name([…]). ``` ```python elementwise_sum = map(op.add, list_a, list_b) sorted_by_second = sorted(, key=op.itemgetter(1)) sorted_by_both = sorted(, key=op.itemgetter(1, 0)) first_element = op.methodcaller('pop', 0)() ``` * **Most operators call the object's special method that is named after them (second object is passed as an argument), while logical operators call their own code that relies on bool().** * **`'and/or'` can't be emulated by a function because they might not evaluate all operands.** * **Comparisons can be chained: `'x < y < z'` gets converted to `'(x < y) and (y < z)'`.** Match Statement --------------- **Executes the first block with matching pattern.** ```python match : case [if ]: ... ``` ### Patterns ```python = 1/'abc'/True/None/math.pi # Matches the literal or attribute's value. = () # Matches any object of that type (or ABC). = _ # Matches any object. Useful in last case. = # Matches any object and binds it to name. = as # Binds match to name. Also (). = | [| ...] # Matches if any of listed patterns match. = [, ...] # Matches a sequence. All items must match. = {: , ...} # Matches a dict if it has matching items. = (=, ...) # Matches object with matching attributes. ``` * **The sequence pattern can also be written as a tuple, either with or without the brackets.** * **Use `'*'` and `'**'` in sequence/mapping patterns to bind remaining items.** * **Patterns can be surrounded with brackets to override their precedence: `'|'` > `'as'` > `','`. For example, `'[1, 2]'` is matched by expression `'case 1|2, 2|3 as y if y == 2:'`.** * **All names that are bound in the matching case, as well as variables initialized in its body, are visible after the match statement (only function block delimits scope).** ### Example ```python >>> from pathlib import Path >>> match Path('/home/ken/python-cheatsheet/README.md'): ... case Path( ... parts=['/', 'home', user, *_] ... ) as p if p.name.lower().startswith('readme') and p.is_file(): ... print(f'{p.name} is a readme file that belongs to user {user}.') README.md is a readme file that belongs to user ken. ``` Logging ------- ```python import logging as log ``` ```python log.basicConfig(filename=, level='WARNING') # Configures the root logger (see Setup). log.debug/info/warning/error/critical() # Sends passed message to the root logger. = log.getLogger(__name__) # Returns a logger named after the module. .() # Sends the message. Same levels as above. .exception() # `error()` that appends caught exception. ``` ### Setup ```python log.basicConfig( filename=None, # Prints to stderr when filename is None. filemode='a', # Use mode 'w' to overwrite existing file. format='%(levelname)s:%(name)s:%(message)s', # Using '%(asctime)s' adds local datetime. level=log.WARNING, # Drops messages that have lower priority. handlers=[log.StreamHandler(sys.stderr)] # Uses FileHandler when 'filename' is set. ) ``` ```python = log.Formatter('') # Formats messages using the format str. = log.FileHandler(, mode='a') # Appends to file. Also `encoding=None`. .setFormatter() # Only outputs bare messages by default. .setLevel() # Prints/saves every message by default. .addHandler() # Loggers can have more than one handler. .setLevel() # What's sent to its/ancestors' handlers. .propagate = # Cuts off ancestors' handlers if False. ``` * **Parent logger can be specified by naming the child logger `'.'`.** * **Logger will inherit the level from its parent if you don't set it via the setLevel() method.** * **Format string can contain: pathname, filename, funcName, lineno, thread and process.** * **RotatingFileHandler rotates files according to 'maxBytes' and 'backupCount' arguments.** * **An object with `'filter()'` method (or the method itself) can be added to loggers and handlers via addFilter(). Message is dropped if filter() returns a false value.** * **Logging messages generated by libraries are passed to the root's handlers. Level of the library's logger can be set with `'log.getLogger("").setLevel()'`.** #### Logger that writes messages to a file and sends them to the root's handler that prints warnings or higher: ```python >>> logger = log.getLogger('my_module') >>> handler = log.FileHandler('test.log', encoding='utf-8') >>> format_str = '%(asctime)s %(levelname)s:%(name)s:%(message)s' >>> handler.setFormatter(log.Formatter(format_str)) >>> logger.addHandler(handler) >>> logger.setLevel('DEBUG') >>> log.basicConfig() >>> roots_handler = log.root.handlers[0] >>> roots_handler.setLevel('WARNING') >>> logger.critical('Missing config file.') CRITICAL:my_module:Missing config file. >>> print(open('test.log').read()) 2023-02-07 23:21:01,430 CRITICAL:my_module:Missing config file. ``` Introspection ------------- ```python = dir() # Local names of objects (including functions and classes). = vars() # Dict of local names and their objects. Same as locals(). = globals() # Dict of global names and their objects, e.g. __builtin__. ``` ```python = dir() # Returns names of object's attributes (including methods). = vars() # Returns dict of writable attributes. Also .__dict__. = hasattr(, '') # Checks if object possesses attribute of the passed name. value = getattr(, '') # Returns the object's attribute or raises AttributeError. setattr(, '', value) # Sets attribute. Only works on objects with __dict__ attr. delattr(, '') # Deletes attribute from __dict__. Also `del .`. ``` Threading --------- **CPython interpreter can only run a single thread at a time. Using multiple threads won't result in a faster execution, unless at least one of the threads contains an I/O operation.** ```python from threading import Thread, Lock, RLock, Semaphore, Event, Barrier from concurrent.futures import ThreadPoolExecutor, as_completed ``` ### Thread ```python = Thread(target=) # Use `args=` to set function's arguments. .start() # Runs function in background. Also is_alive(). .join() # Waits until the function finishes executing. ``` * **Use `'kwargs='` to pass keyword arguments to the function, i.e. thread.** * **Use `'daemon=True'`, or the program won't be able to exit while the thread is alive.** ### Lock ```python = Lock/RLock() # RLock can only be released by acquirer thread. .acquire() # Blocks (waits) until lock becomes available. .release() # Releases the lock so it can be acquired again. ``` #### Or: ```python with : # Enters the block by calling method acquire(). ... # Exits it by calling release(), even on error. ``` ### Semaphore, Event, Barrier ```python = Semaphore(value=1) # Lock that can be acquired by 'value' threads. = Event() # Method wait() blocks until set() is called. = Barrier() # `wait()` blocks until it's called int times. ``` ### Queue ```python = queue.Queue(maxsize=0) # A first-in-first-out queue. It's thread safe. .put() # The call blocks until queue stops being full. .put_nowait() # Raises queue.Full exception if queue is full. = .get() # The call blocks until queue stops being empty. = .get_nowait() # Raises queue.Empty exception if it is empty. ``` ### Thread Pool Executor ```python = ThreadPoolExec…(max_workers=None) # Also `with ThreadPoolExecutor() as : …`. = .map(, , ...) # Multithreaded and non-lazy map(). Keeps order. = .submit(, , ...) # Creates a thread and queues it for execution. .shutdown() # Waits for all the threads to finish executing. ``` ```python = .done() # Checks if the thread has finished executing. = .result(timeout=None) # Raises TimeoutError after 'timeout' seconds. = .cancel() # Just returns False if it is running/finished. = as_completed() # `next()` returns next completed Future. ``` * **Map() and as\_completed() also accept 'timeout' arg. It causes _futures.TimeoutError_ when next() is called or blocking. Map() times from original call and as_completed() from first call to next(). As\_completed() fails if next() is called too late, even if all threads are done.** * **Exceptions that happen inside threads are raised when map's next() or Future's result() method is called. Future's exception() method returns caught exception object or None.** * **ProcessPoolExecutor provides true parallelism but: everything sent to and from workers must be [pickable](#pickle), queues must be sent using executor's 'initargs' and 'initializer' param­eters, and executor should only be reachable via `'if __name__ == "__main__": …'`.** Asyncio ------- * **Coroutines have a lot in common with threads, but unlike threads, they only give up control when they call another coroutine and they don’t consume as much memory.** * **Coroutine definition starts with `'async'` keyword and its call with `'await'` keyword.** * **Execute `'asyncio.run()'` to start running the first/main coroutine.** ```python import asyncio as aio ``` ```python = () # Creates a coroutine by calling async def function. = await # Starts the coroutine. Returns its result or None. = aio.create_task() # Schedules it for execution. Always keep the task. = await # Returns coroutine's result. Also .cancel(). ``` ```python = aio.gather(, ...) # Schedules coros. Returns list of results on await. = aio.wait(, return_when=…) # `'ALL/FIRST_COMPLETED'`. Returns (done, pending). = aio.as_completed() # Calling `await next()` returns next result. ``` #### Runs a terminal game where you control an asterisk that must avoid numbers: ```python import asyncio, collections, curses, curses.textpad, enum, random P = collections.namedtuple('P', 'x y') # Position (x and y coordinates). D = enum.Enum('D', 'n e s w') # Direction (north, east, etc.). W, H = 15, 7 # Width and height of the field. def main(screen): curses.curs_set(0) # Makes the cursor invisible. screen.nodelay(True) # Makes getch() non-blocking. asyncio.run(main_coroutine(screen)) # Starts running asyncio code. async def main_coroutine(screen): moves = asyncio.Queue() state = {'*': P(0, 0)} | dict.fromkeys(range(10), P(W//2, H//2)) ai = [random_controller(id_, moves) for id_ in range(10)] mvc = [controller(screen, moves), model(moves, state), view(state, screen)] tasks = [asyncio.create_task(coro) for coro in ai + mvc] await asyncio.wait(tasks, return_when=asyncio.FIRST_COMPLETED) async def random_controller(id_, moves): while True: d = random.choice(list(D)) moves.put_nowait((id_, d)) await asyncio.sleep(random.triangular(0.01, 0.65)) async def controller(screen, moves): while True: key_mappings = {258: D.s, 259: D.n, 260: D.w, 261: D.e} if d := key_mappings.get(screen.getch()): moves.put_nowait(('*', d)) await asyncio.sleep(0.005) async def model(moves, state): while state['*'] not in (state[id_] for id_ in range(10)): id_, d = await moves.get() deltas = {D.n: P(0, -1), D.e: P(1, 0), D.s: P(0, 1), D.w: P(-1, 0)} state[id_] = P((state[id_].x + deltas[d].x) % W, (state[id_].y + deltas[d].y) % H) async def view(state, screen): offset = P(curses.COLS//2 - W//2, curses.LINES//2 - H//2) while True: screen.erase() curses.textpad.rectangle(screen, offset.y-1, offset.x-1, offset.y+H, offset.x+W) for id_, p in state.items(): screen.addstr(offset.y + (p.y - state['*'].y + H//2) % H, offset.x + (p.x - state['*'].x + W//2) % W, str(id_)) screen.refresh() await asyncio.sleep(0.005) if __name__ == '__main__': curses.wrapper(main) ```
Libraries ========= Progress Bar ------------ ```python # $ pip3 install tqdm >>> import tqdm, time >>> for el in tqdm.tqdm([1, 2, 3], desc='Processing'): ... time.sleep(1) Processing: 100%|████████████████████| 3/3 [00:03<00:00, 1.00s/it] ``` Plot ---- ```python # $ pip3 install matplotlib import matplotlib.pyplot as plt plt.plot/bar/scatter(x_data, y_data, label=None) # Accepts plt.plot(y_data). plt.legend() # Adds a legend of labels. plt.title/xlabel/ylabel() # Adds title or axis label. plt.show() # Also plt.savefig(). plt.clf() # Clears the plot (figure). ``` Table ----- #### Prints a CSV spreadsheet to the console: ```python # $ pip3 install tabulate import csv, tabulate with open('test.csv', encoding='utf-8', newline='') as file: rows = list(csv.reader(file)) print(tabulate.tabulate(rows, headers='firstrow')) ``` Console App ----------- #### Runs a basic file explorer in the console: ```python # $ pip3 install windows-curses import curses, os from curses import A_REVERSE, KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT def main(screen): ch, first, selected, paths = 0, 0, 0, os.listdir() while ch != ord('q'): height, width = screen.getmaxyx() screen.erase() for y, filename in enumerate(paths[first : first+height]): color = A_REVERSE if filename == paths[selected] else 0 screen.addnstr(y, 0, filename, width-1, color) ch = screen.getch() selected -= (ch == KEY_UP) and (selected > 0) selected += (ch == KEY_DOWN) and (selected < len(paths)-1) first -= (first > selected) first += (first < selected-(height-1)) if ch in [KEY_LEFT, KEY_RIGHT, ord('\n')]: new_dir = '..' if ch == KEY_LEFT else paths[selected] if os.path.isdir(new_dir): os.chdir(new_dir) first, selected, paths = 0, 0, os.listdir() if __name__ == '__main__': curses.wrapper(main) ``` GUI App ------- #### Runs a desktop app for converting weights from metric units into pounds: ```python # $ pip3 install FreeSimpleGUI import FreeSimpleGUI as sg text_box = sg.Input(default_text='100', enable_events=True, key='QUANTITY') dropdown = sg.InputCombo(['g', 'kg', 't'], 'kg', readonly=True, enable_events=True, k='UNIT') label = sg.Text('100 kg is 220.462 lbs.', key='OUTPUT') window = sg.Window('GUI App', [[text_box, dropdown], [label], [sg.Button('Close')]]) while True: event, values = window.read() if event in [sg.WIN_CLOSED, 'Close']: break try: quantity = float(values['QUANTITY']) except ValueError: continue unit = values['UNIT'] lbs = quantity * {'g': 0.001, 'kg': 1, 't': 1000}[unit] / 0.45359237 window['OUTPUT'].update(value=f'{quantity} {unit} is {lbs:g} lbs.') window.close() ``` Scraping -------- #### Scrapes Python's URL and logo from its Wikipedia page: ```python # $ pip3 install requests beautifulsoup4 import requests, bs4, os get = lambda url: requests.get(url, headers={'User-Agent': 'cpc-bot'}) response = get('https://en.wikipedia.org/wiki/Python_(programming_language)') document = bs4.BeautifulSoup(response.text, 'html.parser') table = document.find('table', class_='infobox vevent') python_url = table.find('th', string='Website').next_sibling.a['href'] logo_url = table.find('img')['src'] filename = os.path.basename(logo_url) with open(filename, 'wb') as file: file.write(get(f'https:{logo_url}').content) print(f'URL: {python_url}, logo: file://{os.path.abspath(filename)}') ``` ### Selenium **Library for scraping websites with dynamic content.** ```python # $ pip3 install selenium from selenium import webdriver ``` ```python = webdriver.Chrome/Firefox/Safari/Edge() # Opens the browser. Also .quit(). .implicitly_wait(seconds) # Sets timeout for find_element/s() methods. .get('') # Blocks until browser fires the load event. = .page_source # Returns HTML of the page's current state. = .find_element('xpath', ) # Accepts '//[@=""]…'. = .get_attribute('') # Returns attribute or a property if exists. .click/clear() # Also .text and .send_keys(). ``` #### XPath — also available in lxml, Scrapy, and browser's console via `'$x("")'`: ```python = //[/ or // ] # E.g. …/child, …//descendant, …/../sibling. = ///following:: # Next element. Also preceding::, parent::. = # Tag accepts */a/…. Use [1/2/…] for index. = [ [and/or ]] # Use `not()` to negate condition. = @[=""] # `text()=` and `.=` match (complete) text. = contains(@, "") # Is a substring of attribute's value? = [//] # Has matching child? Descendant if //. ``` Web App ------- **Flask is a micro web framework that also includes a simple WSGI/HTTP server. If you just want to open a HTML file in a web browser use `'webbrowser.open()'` instead.** ```python # $ pip3 install flask import flask as fl ``` ```python app = fl.Flask(__name__) # Returns application obj. Put at the top. app.run(host=None, port=None, debug=None) # Also `$ flask --app FILE run --ARG=VAL`. ``` * **Starts the app at `'http://localhost:5000'`. Use `'host="0.0.0.0"'` to run externally.** * **Install a [WSGI](https://en.wikipedia.org/wiki/Web_Server_Gateway_Interface) server like [Waitress](https://flask.palletsprojects.com/en/latest/deploying/waitress/) and a HTTP server such as [Nginx](https://flask.palletsprojects.com/en/latest/deploying/nginx/) to get better security.** * **Debug mode restarts the app whenever script changes and displays errors in the browser.** ### Serving Files ```python @app.route('/img/') def serve_file(filename): return fl.send_from_directory('DIRNAME', filename) ``` ### Serving HTML ```python @app.route('/') def serve_html(sport): return fl.render_template_string('

{{title}}

', title=sport) ``` * **`'fl.render_template(filename, )'` renders a file located in 'templates' dir.** * **`'fl.abort()'` returns error code and `'return fl.redirect()'` redirects.** * **`'fl.request.args[]'` returns parameter from query string (URL part right of '?').** * **`'fl.session[] = '` stores session data and `'fl.session.clear()'` clears it. A session cookie key needs to be set at the startup with `'app.secret_key = '`.** ### Serving JSON ```python @app.post('//odds') def serve_json(sport): team = fl.request.form['team'] return {'team': team, 'odds': [2.09, 3.74, 3.68]} ``` #### Starts the app in its own thread and queries its REST API: ```python # $ pip3 install requests >>> import threading, requests >>> threading.Thread(target=app.run, daemon=True).start() >>> url = 'http://localhost:5000/football/odds' >>> response = requests.post(url, data={'team': 'arsenal f.c.'}) >>> response.json() {'team': 'arsenal f.c.', 'odds': [2.09, 3.74, 3.68]} ``` Profiling --------- ```python from time import perf_counter start_time = perf_counter() ... duration_in_seconds = perf_counter() - start_time ``` ### Timing a Snippet ```python >>> from timeit import timeit >>> timeit('list(range(10000))', number=1000, globals=globals(), setup='pass') 0.19373 ``` ### Profiling by Line ```text $ pip3 install line_profiler $ echo '@profile def main(): a = list(range(10000)) b = set(range(10000)) main()' > test.py $ kernprof -lv test.py Line # Hits Time Per Hit % Time Line Contents ============================================================== 1 @profile 2 def main(): 3 1 253.4 253.4 32.2 a = list(range(10000)) 4 1 534.1 534.1 67.8 b = set(range(10000)) ``` ### Call and Flame Graphs ```bash $ apt install graphviz && pip3 install gprof2dot snakeviz # Or install graphviz.exe. $ tail -n +2 test.py > test.tmp && mv test.tmp test.py # Removes the first line. $ python3 -m cProfile -o test.prof test.py # Runs a tracing profiler. $ gprof2dot -f pstats test.prof | dot -T png -o test.png # Generates a call graph. $ xdg-open test.png # Displays the call graph. $ snakeviz test.prof # Displays a flame graph. ``` ### Sampling and Memory Profilers ```text +--------------+------------+-------------------------------+-------+------+ | pip3 install | Target | How to run | Lines | Live | +--------------+------------+-------------------------------+-------+------+ | pyinstrument | CPU | pyinstrument test.py | No | No | | py-spy | CPU | py-spy top -- python3 test.py | No | Yes | | scalene | CPU+Memory | scalene test.py | Yes | No | | memray | Memory | memray run --live test.py | Yes | Yes | +--------------+------------+-------------------------------+-------+------+ ``` NumPy ----- **Array manipulation mini-language. It can run up to one hundred times faster than the equivalent Python code. An even faster alternative that runs on a GPU is called CuPy.** ```python # $ pip3 install numpy import numpy as np ``` ```python = np.array( [, dtype]) # NumPy array of one or more dimensions. = np.zeros/ones/empty(shape) # Pass a tuple of ints (dimension sizes). = np.arange(from_inc, to_exc, ±step) # Also np.linspace(start, stop, length). = np.random.randint(from_inc, to_exc, shape) # Also random.uniform(low, high, shape). ``` ```python = .reshape(shape) # Also `.shape = (, [...])`. = .flatten() # Returns 1d copy. Also .ravel(). = .transpose() # Flips the table over its main diagonal. ``` ```python = np.copy/abs/sqrt/log/int64() # Returns a new array of the same shape. = .sum/max/mean/argmax/all(axis) # Aggregates dimension with passed index. = np.apply_along_axis(, axis, ) # Func. can return a scalar or an array. ``` ```python = np.concatenate(, axis=0) # Links arrays along first axis (rows). = np.vstack/column_stack() # A 1d array is treated as a row/column. = np.tile/repeat(, [, axis]) # Tiles the array or repeats elements. ``` * **Shape is a tuple of dimension sizes. A 100x50 RGB image has shape (50, 100, 3).** * **Axis is an index of a dimension. Leftmost dimension has index 0. Summing the RGB image along axis 2 will return a greyscale image with shape (50, 100).** ### Indexing ```perl = <2d>[row_index, col_index] # Also `<3d>[, , ]`. <1d_view> = <2d>[row_index] # Also `<3d>[, , ]`. <1d_view> = <2d>[:, col_index] # Also `<3d>[, , ]`. <2d_view> = <2d>[from:to_row_i, from:to_col_i] # Also `<3d>[, , ]`. ``` ```perl <1d_array> = <2d>[row_indices, col_indices] # Also `<3d>[, <1d>, <1d>]`. <2d_array> = <2d>[row_indices] # Also `<3d>[, <1d>, ]`. <2d_array> = <2d>[:, col_indices] # Also `<3d>[, , <1d>]`. <2d_array> = <2d>[np.ix_(row_indices, col_indices)] # Also `<3d>[, <2d>, <2d>]`. ``` ```perl <2d_bools> = <2d> > # A 1d object must be a size of a row. <1/2d_arr> = <2d>[<2d/1d_bools>] # A 1d object must be a size of a col. ``` * **`':'` returns a slice of all dimension's indices. If dimension is omitted, it defaults to `':'`.** * **Passing two slices (line 4) works the same as when a slice and 1d array are passed (line 7).** * **Python converts `'obj[i, j]'` to `'obj[(i, j)]'`. This makes `'<2d>[row_i, col_i]'` and `'<2d>[row_indices]'` indistinguishable to NumPy if tuple of two indices is passed.** * **`'ix_([1, 2], [3, 4])'` returns `'[[1], [2]]'` and `'[[3, 4]]'`. Due to broadcasting rules, this is the same as indexing via `'[[1, 1], [2, 2]]'` and `'[[3, 4], [3, 4]]'`.** * **Any value that is broadcastable to the indexed shape can be assigned to the selection.** ### Broadcasting **Array reshaping procedure used by arithmetic operations, etc.** ```python array_a = np.array([0.1, 0.6, 0.8]) # I.e. `array_a.shape == (3,)`. array_b = np.array([[0.1], [0.6], [0.8]]) # I.e. `array_b.shape == (3, 1)`. ``` #### 1. If array shapes differ in length, left-pad the shorter shape with ones: ```python array_a = np.array([[0.1, 0.6, 0.8]]) # I.e. `array_a.shape == (1, 3)`. array_b = np.array([[0.1], [0.6], [0.8]]) # I.e. `array_b.shape == (3, 1)`. ``` #### 2. Expand dimensions with size 1 by duplicating their elements/arrays: ```python array_a = np.array([[0.1, 0.6, 0.8], # I.e. `array_a.shape == (3, 3)`. [0.1, 0.6, 0.8], [0.1, 0.6, 0.8]]) array_b = np.array([[0.1, 0.1, 0.1], # I.e. `array_b.shape == (3, 3)`. [0.6, 0.6, 0.6], [0.8, 0.8, 0.8]]) ``` ### Example #### For each point returns index of its nearest point (`[0.1, 0.6, 0.8] => [1, 2, 1]`): ```python >>> print(points := np.array([0.1, 0.6, 0.8])) [0.1 0.6 0.8] >>> print(wrapped_points := points.reshape(3, 1)) [[0.1] [0.6] [0.8]] >>> print(deltas := points - wrapped_points) [[ 0. 0.5 0.7] [-0.5 0. 0.2] [-0.7 -0.2 0. ]] >>> deltas[range(3), range(3)] = np.inf >>> print(distances := np.abs(deltas)) [[inf 0.5 0.7] [0.5 inf 0.2] [0.7 0.2 inf]] >>> print(distances.argmin(axis=1)) [1 2 1] ``` Image ----- ```python # $ pip3 install pillow from PIL import Image ``` ```python = Image.new('RGB', (width, height)) # Creates an image. Also `color=`. = Image.open() # Identifies format based on the file's contents. = .convert('') # Converts the image to the new mode (see Modes). .save() # Also `quality=` if extension is jpg/jpeg. .show() # Displays image in system's default preview app. ``` ```python = .getpixel((x, y)) # Returns the pixel's value, that is, its color. = .getdata() # Returns a flattened view of the pixel values. .putpixel((x, y), ) # Updates pixel's value. Clips passed integer/s. .putdata() # Updates pixels with a copy of passed sequence. .paste(, (x, y)) # Draws passed image at the specified location. ``` ```python = .filter() # Accepts ImageFilter.BLUR/SHARPEN/FIND_EDGES/…. = .enhance() # E.g. `ImageEnhance.Contrast/Color/…()`. ``` ```python = np.array() # Creates a 2d or 3d NumPy array from the image. = Image.fromarray(np.uint8()) # Use `.clip(0, 255)` to clip the values. ``` ### Modes * **`'L'` - Lightness (greyscale image). Each pixel is stored as an int between 0 and 255.** * **`'RGB'` - Red, green, blue (true color image). Each pixel is a tuple of three integers.** * **`'RGBA'` - RGB with alpha. Low alpha (i.e. fourth int) makes pixel more transparent.** * **`'HSV'` - Hue, saturation, value. Three ints representing color in HSV color space.** ### Examples #### Creates a PNG image of a rainbow gradient: ```python WIDTH, HEIGHT = 100, 100 n_pixels = WIDTH * HEIGHT hues = (255 * i/n_pixels for i in range(n_pixels)) img = Image.new('HSV', (WIDTH, HEIGHT)) img.putdata([(int(h), 255, 255) for h in hues]) img.convert('RGB').save('test.png') ``` #### Adds noise to the PNG image and displays it: ```python from random import randint add_noise = lambda value: max(0, min(255, value + randint(-20, 20))) img = Image.open('test.png').convert('HSV') img.putdata([(add_noise(h), s, v) for h, s, v in img.getdata()]) img.show() ``` ### Image Draw ```python from PIL import ImageDraw = ImageDraw.Draw() # An object for adding 2D graphics to the image. .point((x, y)) # Draws a point. Accepts `fill=`. .line((x1, y1, x2, y2 [, ...])) # To get anti-aliasing use .resize((w, h)). .arc((x1, y1, x2, y2), deg1, deg2) # Draws arc of an ellipse in clockwise direction. .rectangle((x1, y1, x2, y2)) # Also rounded_rectangle() and regular_polygon(). .polygon((x1, y1, x2, y2, ...)) # The last point gets connected to the first one. .ellipse((x1, y1, x2, y2)) # To rotate it use .rotate(anticlock_deg). .text((x, y), ) # Accepts `font=ImageFont.truetype(path, size)`. ``` * **Pass `'fill='` to set primary color of the figure.** * **Pass `'width='` to set the width of lines or contours.** * **Pass `'outline='` to set the color of the contours.** * **Color can be an int, tuple, `'#rrggbb[aa]'` or color name.** Animation --------- #### Creates a GIF of a bouncing ball: ```python # $ pip3 install imageio from PIL import Image, ImageDraw import imageio WIDTH, HEIGHT, R = 126, 126, 10 frames = [] for velocity in range(1, 16): y = sum(range(velocity)) frame = Image.new('L', (WIDTH, HEIGHT)) draw = ImageDraw.Draw(frame) draw.ellipse((WIDTH/2-R, y, WIDTH/2+R, y+R*2), fill='white') frames.append(frame) frames += reversed(frames[1:-1]) imageio.mimsave('test.gif', frames, duration=0.03) ``` Audio ----- ```python import wave ``` ```python = wave.open('') # Opens specified WAV file for reading. = .getframerate() # Returns number of frames per second. = .getnchannels() # Returns number of samples per frame. = .getsampwidth() # Returns number of bytes per sample. = .getparams() # Returns namedtuple of all parameters. = .readframes(nframes) # Returns all frames if `-1` is passed. ``` ```python = wave.open('', 'wb') # Creates/truncates a file for writing. .setframerate() # Pass 44100, or 48000 for video track. .setnchannels() # Pass 1 for mono, 2 for stereo signal. .setsampwidth() # Pass 2 for CD, 3 for hi-res quality. .setparams() # Passed tuple must contain all params. .writeframes() # Appends passed frames to audio file. ``` * **The bytes object contains a sequence of frames, each consisting of one or more samples.** * **In stereo signal, first sample of a frame belongs to the left channel (second to the right).** * **Each sample consists of one or more bytes (depending on sample width) that, when con­verted to an integer, indicate the displacement of a speaker membrane at that moment.** * **If sample width is one byte, then the integer should be encoded unsigned. For all other sizes, the integer should be encoded signed with little-endian byte order.** ### Sample Values ```text +-----------+-----------+------+-----------+ | sampwidth | min | zero | max | +-----------+-----------+------+-----------+ | 1 | 0 | 128 | 255 | | 2 | -32768 | 0 | 32767 | | 3 | -8388608 | 0 | 8388607 | +-----------+-----------+------+-----------+ ``` ### Read Float Samples from WAV File ```python def read_wav_file(filename): def get_int(bytes_obj): an_int = int.from_bytes(bytes_obj, 'little', signed=(p.sampwidth != 1)) return an_int - (128 * (p.sampwidth == 1)) with wave.open(filename) as file: p = file.getparams() frames = file.readframes(-1) samples_b = (frames[i : i + p.sampwidth] for i in range(0, len(frames), p.sampwidth)) return [get_int(b) / pow(2, (p.sampwidth * 8) - 1) for b in samples_b], p ``` ### Write Float Samples to WAV File ```python def write_to_wav_file(filename, samples_f, p=None, nchannels=1, sampwidth=2, fs=44100): def get_bytes(a_float): a_float = max(-1, min(1 - 2e-16, a_float)) + (p.sampwidth == 1) a_float *= pow(2, (p.sampwidth * 8) - 1) return int(a_float).to_bytes(p.sampwidth, 'little', signed=(p.sampwidth != 1)) if p is None: p = wave._wave_params(nchannels, sampwidth, fs, 0, 'NONE', 'not compressed') with wave.open(filename, 'wb') as file: file.setparams(p) file.writeframes(b''.join(get_bytes(f) for f in samples_f)) ``` ### Examples #### Saves a 440 Hz sine wave to a mono WAV file: ```python from math import sin, pi get_sin = lambda i: sin(i * 2 * pi * 440 / 44100) * 0.2 write_to_wav_file('test.wav', (get_sin(i) for i in range(100_000))) ``` #### Adds noise to the WAV file: ```python from random import uniform samples_f, prms = read_wav_file('test.wav') samples_f = (f + uniform(-0.02, 0.02) for f in samples_f) write_to_wav_file('test.wav', samples_f, p=prms) ``` ### Audio Player ```python # $ pip3 install nava from nava import play play('test.wav') ``` ### Text to Speech ```python # $ pip3 install piper-tts sounddevice import os, piper, sounddevice os.system('python3 -m piper.download_voices en_US-lessac-high') voice = piper.PiperVoice.load('en_US-lessac-high.onnx') for sentence in voice.synthesize('Sally sells seashells by the seashore.'): sounddevice.wait() sounddevice.play(sentence.audio_float_array, sentence.sample_rate) sounddevice.wait() ``` Synthesizer ----------- #### Plays Popcorn by Gershon Kingsley: ```python # $ pip3 install numpy sounddevice import itertools as it, math, numpy as np, sounddevice def play_notes(notes, bpm=132, fs=44100, volume=0.1): beat_len = 60/bpm * fs get_pause = lambda n_beats: it.repeat(0, int(n_beats * beat_len)) get_sinus = lambda i, hz: math.sin(i * 2 * math.pi * hz / fs) * volume get_wave = lambda hz, n_beats: (get_sinus(i, hz) for i in range(int(n_beats * beat_len))) get_hertz = lambda note: 440 * 2 ** ((int(note[:2]) - 69) / 12) get_beats = lambda note: 1/2 if '♩' in note else 1/4 if '♪' in note else 1 get_samps = lambda n: get_wave(get_hertz(n), get_beats(n)) if n else get_pause(1/4) samples_f = it.chain(get_pause(1/2), *(get_samps(n) for n in notes.split(','))) sounddevice.play(np.fromiter(samples_f, np.float32), fs, blocking=True) play_notes('83♩,81♪,,83♪,,78♪,,74♪,,78♪,,71♪,,,,83♪,,81♪,,83♪,,78♪,,74♪,,78♪,,71♪,,,,' '83♩,85♪,,86♪,,85♪,,86♪,,83♪,,85♩,83♪,,85♪,,81♪,,83♪,,81♪,,83♪,,79♪,,83♪,,,,') ``` Pygame ------ #### Opens a window and draws a square that can be moved with arrow keys: ```python # $ pip3 install pygame import pygame as pg pg.init() screen = pg.display.set_mode((500, 500)) rect = pg.Rect(240, 240, 20, 20) while not pg.event.get(pg.QUIT): for event in pg.event.get(pg.KEYDOWN): dx = (event.key == pg.K_RIGHT) - (event.key == pg.K_LEFT) dy = (event.key == pg.K_DOWN) - (event.key == pg.K_UP) rect = rect.move((dx * 20, dy * 20)) screen.fill(pg.Color('black')) pg.draw.rect(screen, pg.Color('white'), rect) pg.display.flip() pg.quit() ``` ### Rect **Object for storing rectangular coordinates.** ```python = pg.Rect(x, y, width, height) # Creates Rect object. Truncates passed floats. = .x/y/centerx/centery/… # `top/right/bottom/left`. Allows assignments. = .topleft/center/… # `topright/bottomright/bottomleft/size`. Same. = .move((delta_x, delta_y)) # Use move_ip() to move the rectangle in-place. ``` ```python = .collidepoint((x, y)) # Returns True if rectangle contains the point. = .colliderect() # Returns True if the rectangles are colliding. = .collidelist() # Returns index of first colliding Rect or -1. = .collidelistall() # Returns indices of all colliding rectangles. ``` ### Surface **Object for representing images.** ```python = pg.display.set_mode((width, height)) # Opens new window and returns surface object. = pg.Surface((width, height)) # New RGB surface. RGBA if `flags=pg.SRCALPHA`. = pg.image.load() # Loads the image. Also get_width/get_height(). = pg.surfarray.make_surface() # Also ` = surfarray.pixels3d()`. = .subsurface() # Creates a new surface object from the cutout. ``` ```python .fill(color) # Pass tuple of ints or pg.Color(''). .set_at((x, y), color) # Updates a pixel. Also .get_at((x, y)). .blit(, (x, y)) # Draws passed surface at a specified location. ``` ```python from pygame.transform import scale, rotate # Also flip, smoothscale, scale_by, rotozoom. = scale(, (width, height)) # Scales the surface. `smoothscale()` blurs it. = rotate(, angle) # Rotates the surface for counterclock degrees. = flip(, flip_x=True) # Mirrors over the y axis. Also `flip_y=True`. ``` ```python from pygame.draw import line, arc, rect # Also ellipse, circle, polygon, lines, aaline. line(, color, (x1, y1), (x2, y2)) # Draws line to surface. Accepts `width=`. arc(, color, , from_rad, to_rad) # Also ellipse(, color, , width=0). rect(, color, , width=0) # Also polygon(, color, points, width=0). ``` ```python = pg.font.Font(, size) # Loads a TTF file. Pass None for default font. = .render(text, antialias, color) # Accepts background color via fourth argument. ``` ### Sound ```python = pg.mixer.Sound() # Accepts WAV file or array of short integers. .play/stop() # Also set_volume() and fadeout(msec). ``` ### Basic Mario Brothers Example ```python import collections, dataclasses, enum, io, itertools as it, pygame as pg, urllib.request from random import randint P = collections.namedtuple('P', 'x y') # Position (x and y coordinates). D = enum.Enum('D', 'n e s w') # Direction (north, east, etc.). W, H, MAX_S = 50, 50, P(5, 10) # Width, height, maximum speed. def main(): def get_screen(): pg.init() return pg.display.set_mode((W*16, H*16)) def get_images(): url = 'https://gto76.github.io/python-cheatsheet/web/mario_bros.png' img = pg.image.load(io.BytesIO(urllib.request.urlopen(url).read())) return [img.subsurface(get_rect(x, 0)) for x in range(img.get_width() // 16)] def get_mario(): Mario = dataclasses.make_dataclass('Mario', 'rect spd facing_left frame_cycle'.split()) return Mario(get_rect(1, 1), P(0, 0), False, it.cycle(range(3))) def get_tiles(): border = [(x, y) for x in range(W) for y in range(H) if x in [0, W-1] or y in [0, H-1]] platforms = [(randint(1, W-2), randint(2, H-2)) for _ in range(W*H // 10)] return [get_rect(x, y) for x, y in border + platforms] def get_rect(x, y): return pg.Rect(x*16, y*16, 16, 16) run(get_screen(), get_images(), get_mario(), get_tiles()) def run(screen, images, mario, tiles): clock = pg.time.Clock() pressed = set() while not pg.event.get(pg.QUIT): clock.tick(28) pressed |= {e.key for e in pg.event.get(pg.KEYDOWN)} pressed -= {e.key for e in pg.event.get(pg.KEYUP)} update_speed(mario, tiles, pressed) update_position(mario, tiles) draw(screen, images, mario, tiles) pg.quit() def update_speed(mario, tiles, pressed): x, y = mario.spd x += 2 * ((pg.K_RIGHT in pressed) - (pg.K_LEFT in pressed)) x += (x < 0) - (x > 0) y += 1 if D.s not in get_boundaries(mario.rect, tiles) else (pg.K_UP in pressed) * -10 mario.spd = P(x=max(-MAX_S.x, min(MAX_S.x, x)), y=max(-MAX_S.y, min(MAX_S.y, y))) def update_position(mario, tiles): x, y = mario.rect.topleft n_steps = max(abs(s) for s in mario.spd) for _ in range(n_steps): mario.spd = stop_on_collision(mario.spd, get_boundaries(mario.rect, tiles)) mario.rect.topleft = x, y = x + (mario.spd.x / n_steps), y + (mario.spd.y / n_steps) def get_boundaries(rect, tiles): deltas = {D.n: P(0, -1), D.e: P(1, 0), D.s: P(0, 1), D.w: P(-1, 0)} return {d for d, delta in deltas.items() if rect.move(delta).collidelist(tiles) != -1} def stop_on_collision(spd, bounds): return P(x=0 if (D.w in bounds and spd.x < 0) or (D.e in bounds and spd.x > 0) else spd.x, y=0 if (D.n in bounds and spd.y < 0) or (D.s in bounds and spd.y > 0) else spd.y) def draw(screen, images, mario, tiles): screen.fill((85, 168, 255)) mario.facing_left = mario.spd.x < 0 if mario.spd.x else mario.facing_left is_airborne = D.s not in get_boundaries(mario.rect, tiles) image_index = 4 if is_airborne else next(mario.frame_cycle) if mario.spd.x else 6 screen.blit(images[image_index + (mario.facing_left * 9)], mario.rect) for tile in tiles: is_border = tile.x in [0, (W-1)*16] or tile.y in [0, (H-1)*16] screen.blit(images[18 if is_border else 19], tile) pg.display.flip() if __name__ == '__main__': main() ``` Pandas ------ **Data analysis library. For examples see [Plotly](#plotly).** ```python # $ pip3 install pandas matplotlib import pandas as pd, matplotlib.pyplot as plt ``` ### Series **Ordered dictionary with a name.** ```python >>> s = pd.Series([1, 2], index=['x', 'y'], name='a'); s x 1 y 2 Name: a, dtype: int64 ``` ```python = pd.Series() # Uses list's indices for 'index'. = pd.Series() # Uses dictionary's keys for 'index'. ``` ```python = .loc[key] # Or: .iloc[i] = .loc[coll_of_keys] # Or: .iloc[coll_of_i] = .loc[from_key : to_key_inc] # Or: .iloc[from_i : to_i_exc] ``` ```python = [key/i] # Or: . = [coll_of_keys/coll_of_i] # Or: [key/i : key/i] = [] # Or: .loc/iloc[] ``` ```python = > # Returns S of bools. For logic use &, |, ~. = + # Items with non-matching keys get value NaN. ``` ```python = .head/describe/sort_values() # Also .unique/value_counts/round/dropna(). = .str.strip/lower/contains/replace() # Also split().str[i] or split(expand=True). = .dt.year/month/day/hour # Use pd.to_datetime() to get S of datetimes. = .dt.to_period('y/m/d/h') # Quantizes datetimes into Period objects. ``` ```python .plot.line/area/bar/pie/hist() # Generates a plot. Accepts `title=`. plt.show() # Displays the plot. Also plt.savefig(). ``` * **Use `'print(.to_string())'` to print a Series that has more than sixty items.** * **Use `'.index'` to get collection of keys and `'.index = '` to update them.** * **Only pass a list or Series to loc/iloc because `'obj[x, y]'` is converted to `'obj[(x, y)]'` and `'.loc[key_1, key_2]'` is how you retrieve a value from a multi-indexed Series.** * **Pandas uses NumPy types like `'np.int64'`. Series is converted to `'float64'` if np.nan is assigned to any item. Use `'.astype()'` to get converted Series.** #### Series — Aggregate, Transform, Map: ```python = .sum/max/mean/std/idxmax/count() # Or: .agg(lambda : ) = .rank/diff/cumsum/ffill/interpol…() # Or: .agg/transform(lambda : ) = .isna/fillna/isin([]) # Or: .agg/transform/map(lambda : ) ``` ```text +--------------+-------------+-------------+---------------+ | | 'sum' | ['sum'] | {'s': 'sum'} | +--------------+-------------+-------------+---------------+ | s.apply(…) | 3 | sum 3 | s 3 | | s.agg(…) | | | | +--------------+-------------+-------------+---------------+ ``` ```text +--------------+-------------+-------------+---------------+ | | 'rank' | ['rank'] | {'r': 'rank'} | +--------------+-------------+-------------+---------------+ | s.apply(…) | | rank | | | s.agg(…) | x 1.0 | x 1.0 | r x 1.0 | | | y 2.0 | y 2.0 | y 2.0 | +--------------+-------------+-------------+---------------+ ``` ### DataFrame **Table with labeled rows and columns.** ```python >>> df = pd.DataFrame([[1, 2], [3, 4]], index=['a', 'b'], columns=['x', 'y']); df x y a 1 2 b 3 4 ``` ```python = pd.DataFrame() # Rows can be either lists, dicts or series. = pd.DataFrame() # Columns can be either lists, dicts or series. ``` ```python = .loc[row_key, col_key] # Or: .iloc[row_i, col_i] = .loc[row_key/s] # Or: .iloc[row_i/s] = .loc[:, col_key/s] # Or: .iloc[:, col_i/s] = .loc[row_bools, col_bools] # Or: .iloc[row_bools, col_bools] ``` ```python = [col_key/s] # Or: . = [] # Filters rows. For example `df[df.x > 1]`. = [] # Assigns NaN to items that are False in bools. ``` ```python = > # Returns DF of bools. Treats series as a row. = + # Items with non-matching keys get value NaN. ``` ```python = .set_index(col_key) # Replaces row keys with column's values. = .reset_index(drop=False) # Drops or moves row keys to column named index. = .sort_index(ascending=True) # Sorts rows by row keys. Use `axis=1` for cols. = .sort_values(col_key/s) # Sorts rows by passed column/s. Also `axis=1`. ``` ```python = .head/tail/sample() # Returns first, last, or random n rows. = .describe() # Describes columns. Also info(), corr(), shape. = .query('') # Filters rows. For example `df.query('x > 1')`. ``` ```python .plot.line/area/bar/scatter(x=col_key, …) # `y=col_key/s`. Also hist/box(column/by=col_k). plt.show() # Displays the plot. Also plt.savefig(). ``` #### DataFrame — Merge, Join, Concat: ```python >>> df_2 = pd.DataFrame([[4, 5], [6, 7]], index=['b', 'c'], columns=['y', 'z']); df_2 y z b 4 5 c 6 7 ``` ```text +-----------------------+---------------+------------+------------+---------------------------+ | | 'outer' | 'inner' | 'left' | Description | +-----------------------+---------------+------------+------------+---------------------------+ | df.merge(df_2, | x y z | x y z | x y z | Merges on column if 'on' | | on='y', | 0 1 2 . | 3 4 5 | 1 2 . | or 'left_on/right_on' are | | how=…) | 1 3 4 5 | | 3 4 5 | set, else on shared cols. | | | 2 . 6 7 | | | Uses 'inner' by default. | +-----------------------+---------------+------------+------------+---------------------------+ | df.join(df_2, | x yl yr z | | x yl yr z | Merges on row keys. | | lsuffix='l', | a 1 2 . . | x yl yr z | 1 2 . . | Uses 'left' by default. | | rsuffix='r', | b 3 4 4 5 | 3 4 4 5 | 3 4 4 5 | If Series is passed, it | | how=…) | c . . 6 7 | | | is treated as a column. | +-----------------------+---------------+------------+------------+---------------------------+ | pd.concat([df, df_2], | x y z | y | | Adds rows at the bottom. | | axis=0, | a 1 2 . | 2 | | Uses 'outer' by default. | | join=…) | b 3 4 . | 4 | | A Series is treated as a | | | b . 4 5 | 4 | | column. To add a row use | | | c . 6 7 | 6 | | pd.concat([df, DF([s])]). | +-----------------------+---------------+------------+------------+---------------------------+ | pd.concat([df, df_2], | x y y z | | | Adds columns at the | | axis=1, | a 1 2 . . | x y y z | | right end. Uses 'outer' | | join=…) | b 3 4 4 5 | 3 4 4 5 | | by default. A Series is | | | c . . 6 7 | | | treated as a column. | +-----------------------+---------------+------------+------------+---------------------------+ ``` #### DataFrame — Aggregate, Transform, Map: ```python = .sum/max/mean/std/idxmax/count() # Or: .apply/agg(lambda : ) = .rank/diff/cumsum/ffill/interpo…() # Or: .apply/agg/transform(lambda : ) = .isna/fillna/isin([]) # Or: .applymap(lambda : ) ``` ```text +-----------------+---------------+---------------+---------------+ | | 'sum' | ['sum'] | {'x': 'sum'} | +-----------------+---------------+---------------+---------------+ | df.apply(…) | x 4 | x y | x 4 | | df.agg(…) | y 6 | sum 4 6 | | +-----------------+---------------+---------------+---------------+ ``` ```text +-----------------+---------------+---------------+---------------+ | | 'rank' | ['rank'] | {'x': 'rank'} | +-----------------+---------------+---------------+---------------+ | df.apply(…) | | x y | | | df.agg(…) | x y | rank rank | x | | df.transform(…) | a 1.0 1.0 | a 1.0 1.0 | a 1.0 | | | b 2.0 2.0 | b 2.0 2.0 | b 2.0 | +-----------------+---------------+---------------+---------------+ ``` * **Listed methods process the columns unless they receive `'axis=1'`. Exceptions to this rule are `'.dropna()'`, `'.drop(row_key/s)'` and `'.rename()'`.** * **Fifth result's columns are indexed with a multi-index. This means we need a tuple of column keys to specify a column: `'.loc[row_key, (col_key_1, col_key_2)]'`.** ### Multi-Index ```python = .loc[row_key_1] # Or: .xs(row_key_1) = .loc[:, (slice(None), col_key_2)] # Or: .xs(col_key_2, axis=1, level=1) = .set_index(col_keys) # Creates index from cols. Also `append=False`. = .pivot_table(index=col_key/s) # `columns=key/s, values=key/s, aggfunc='mean'`. = .stack/unstack(level=-1) # Combines col keys with row keys or vice versa. ``` ### File Formats ```python = pd.read_json/pickle() # Also io.StringIO(), io.BytesIO(). = pd.read_csv/excel() # Also `header/index_col/dtype/usecols/…=`. = pd.read_html() # Raises ImportError if webpage has zero tables. = pd.read_parquet/feather/hdf() # Function read_hdf() accepts `key=`. = pd.read_sql('', ) # Pass SQLite3/Alchemy connection. See #SQLite. ``` ```python .to_json/csv/html/latex/parquet() # Returns a string/bytes if path is omitted. .to_pickle/excel/feather/hdf() # Method to_hdf() requires `key=`. .to_sql('', ) # Also `if_exists='fail/replace/append'`. ``` * **`'$ pip3 install "pandas[excel]" odfpy lxml pyarrow'` installs dependencies.** * **Csv functions use the same dialect as standard library's csv module (e.g. `'sep=","'`).** * **Read\_csv() only parses dates of columns that are listed in 'parse\_dates'. It automatically tries to detect the format, but it can be helped with 'date\_format' or 'dayfirst' arguments.** * **We get a dataframe with DatetimeIndex if 'parse_dates' argument includes 'index\_col'. Its `'resample("y/m/d/h")'` method returns Resampler object that is similar to GroupBy.** ### GroupBy **Object that groups together rows of a dataframe based on the value of the passed column.** ```python = .groupby(col_key/s) # Splits DF into groups based on passed column. = .apply/filter() # Filter drops a group if func returns False. = .get_group() # Selects a group by grouping column's value. = .size() # S of group sizes. Same keys as get_group(). = [col_key] # Single column GB. All operations return S. ``` ```python = .sum/max/mean/std/idxmax/count() # Or: .agg(lambda : ) = .rank/diff/cumsum/ffill() # Or: .transform(lambda : ) = .fillna() # Or: .transform(lambda : ) ``` #### Divides rows into groups and sums their columns. Result has a named index that creates column `'z'` on reset_index(): ```python >>> df = pd.DataFrame([[1, 2, 3], [4, 5, 6], [7, 8, 6]], list('abc'), list('xyz')) >>> gb = df.groupby('z'); gb.apply(print) x y z a 1 2 3 x y z b 4 5 6 c 7 8 6 >>> gb.sum() x y z 3 1 2 6 11 13 ``` ### Rolling **Object for rolling window calculations.** ```python = .rolling(win_size) # Also: `min_periods=None, center=False`. = [col_key/s] # Or: . = .mean/sum/max() # Or: .apply/agg() ``` Plotly ------ ```python # $ pip3 install plotly kaleido pandas import plotly.express as px, pandas as pd ``` ```python = px.line( [, y=col_key/s [, x=col_key]]) # Also px.line(y= [, x=]). .update_layout(paper_bgcolor='#rrggbb') # Also `margin=dict(t=0, r=0, b=0, l=0)`. .write_html/json/image('') # Use .show() to display the plot. ``` ```python = px.area/bar/box(, x=col_key, y=col_keys) # Also `color=col_key`. All are optional. = px.scatter(, x=col_key, y=col_keys) # Also `color/size/symbol=col_key`. Same. = px.scatter_3d(, x=col_key, y=col_key, …) # `z=col_key`. Also color, size, symbol. = px.histogram(, x=col_keys, y=col_key) # Also color, nbins. All are optional. ``` #### Displays a line chart of total COVID-19 deaths per million grouped by continent: ![Covid Deaths](web/covid_deaths.png)
```python covid = pd.read_csv('https://raw.githubusercontent.com/owid/covid-19-data/8dde8ca49b' '6e648c17dd420b2726ca0779402651/public/data/owid-covid-data.csv', usecols=['iso_code', 'date', 'population', 'total_deaths']) continents = pd.read_csv('https://gto76.github.io/python-cheatsheet/web/continents.csv', usecols=['Three_Letter_Country_Code', 'Continent_Name']) df = pd.merge(covid, continents, left_on='iso_code', right_on='Three_Letter_Country_Code') df = df.groupby(['Continent_Name', 'date']).sum().reset_index() df['Total Deaths per Million'] = df.total_deaths * 1e6 / df.population df = df[df.date > '2020-03-14'] df = df.rename({'date': 'Date', 'Continent_Name': 'Continent'}, axis='columns') px.line(df, x='Date', y='Total Deaths per Million', color='Continent') ``` #### Displays a multi-axis line chart of total COVID-19 cases and changes in prices of Bitcoin, Dow Jones and gold: ![Covid Cases](web/covid_cases.png)
```python # $ pip3 install pandas lxml selenium plotly import pandas as pd, selenium.webdriver, io, plotly.graph_objects as go def main(): covid, (bitcoin, gold, dow) = get_covid_cases(), get_tickers() df = wrangle_data(covid, bitcoin, gold, dow) display_data(df) def get_covid_cases(): url = 'https://catalog.ourworldindata.org/garden/covid/latest/compact/compact.csv' df = pd.read_csv(url, parse_dates=['date']) df = df[df.country == 'World'] s = df.set_index('date').total_cases return s.rename('Total Cases') def get_tickers(): with selenium.webdriver.Chrome() as driver: driver.implicitly_wait(10) symbols = {'Bitcoin': 'BTC-USD', 'Gold': 'GC=F', 'Dow Jones': '%5EDJI'} return [get_ticker(driver, name, symbol) for name, symbol in symbols.items()] def get_ticker(driver, name, symbol): url = f'https://finance.yahoo.com/quote/{symbol}/history/' driver.get(url + '?period1=1579651200&period2=9999999999') if buttons := driver.find_elements('xpath', '//button[@name="reject"]'): buttons[0].click() html = io.StringIO(driver.page_source) dataframes = pd.read_html(html, parse_dates=['Date']) s = dataframes[0].set_index('Date').Open return s.rename(name) def wrangle_data(covid, bitcoin, gold, dow): df = pd.concat([bitcoin, gold, dow], axis=1) # Creates table by joining columns on dates. df = df.sort_index().interpolate() # Sorts rows by date and interpolates NaN-s. df = df.loc['2020-02-23':'2021-12-20'] # Keeps rows between specified dates. df = (df / df.iloc[0]) * 100 # Calculates percentages relative to day 1. df = df.join(covid) # Adds column with covid cases. return df.sort_values(df.index[-1], axis=1) # Sorts columns by last day's value. def display_data(df): figure = go.Figure() for col_name in reversed(df.columns): yaxis = 'y1' if col_name == 'Total Cases' else 'y2' trace = go.Scatter(x=df.index, y=df[col_name], yaxis=yaxis, name=col_name) figure.add_trace(trace) figure.update_layout( width=944, height=423, yaxis1=dict(title='Total Cases', rangemode='tozero'), yaxis2=dict(title='%', rangemode='tozero', overlaying='y', side='right'), colorway=['#EF553B', '#636EFA', '#00CC96', '#FFA152'], legend=dict(x=1.08) ) figure.show() if __name__ == '__main__': main() ``` Appendix -------- ### Cython **Library that compiles Python-like code into C.** ```python # $ pip3 install cython import pyximport; pyximport.install() # Module that runs Cython scripts. import # Script must have '.pyx' extension. ``` #### All `'cdef'` definitions are optional, but they contribute to the speed-up: ```python cdef [= ] # Either Python or C type variable. cdef * [= &] # Use [0] to get the value. cdef [size] [= ] # Also `[:] = `. cdef * [= ] # E.g. `< *> malloc(n_bytes)`. ``` ```python cdef ( [*]): ... # Omitted types default to `object`. ``` ```python cdef class : # Also `cdef struct :`. cdef public [*] # Also `... [*]`. def __init__(self, ): # Also `cdef __dealloc__(self):`. self. = # Also `... free()`. ``` ### Virtual Environments **System for installing libraries directly into project's directory.** ```perl $ python3 -m venv NAME # Creates virtual environment in current directory. $ source NAME/bin/activate # Activates it. On Windows run `NAME\Scripts\activate`. $ pip3 install LIBRARY # Installs the library into active environment. $ python3 FILE # Runs the script in active environment. Also `./FILE`. $ deactivate # Deactivates the active virtual environment. ``` ### Basic Script Template **Run the script with `'$ python3 FILE'` or `'$ chmod u+x FILE; ./FILE'`. To automatically start the debugger when uncaught exception occurs run `'$ python3 -m pdb -cc FILE'`.** ```python #!/usr/bin/env python3 # # Usage: .py # from sys import argv, exit from collections import defaultdict, namedtuple from dataclasses import make_dataclass from enum import Enum import functools as ft, itertools as it, operator as op, re def main(): pass ### ## UTIL # def read_file(filename): with open(filename, encoding='utf-8') as file: return file.readlines() if __name__ == '__main__': main() ``` Index ----- * **Ctrl+F / ⌘F is usually sufficient.** * **Searching `'#'` on the [webpage](https://gto76.github.io/python-cheatsheet/) will limit the search to the titles.** * **Click on the title's `'🔗'` to get a link to its section.** ================================================ FILE: index.html ================================================ <!DOCTYPE html> <html class="ocks-org do-not-copy" lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" /> <title>Comprehensive Python Cheatsheet

Comprehensive Python Cheatsheet

ToC = {
    '1. Collections': [List, Dictionary, Set, Tuple, Range, Enumerate, Iterator, Generator],
    '2. Types':       [Type, String, Regular_Exp, Format, Numbers, Combinatorics, Datetime],
    '3. Syntax':      [Function, Inline, Import, Decorator, Class, Duck_Type, Enum, Except],
    '4. System':      [Exit, Print, Input, Command_Line_Arguments, Open, Path, OS_Commands],
    '5. Data':        [JSON, Pickle, CSV, SQLite, Bytes, Struct, Array, Memory_View, Deque],
    '6. Advanced':    [Operator, Match_Statement, Logging, Introspection, Threads, Asyncio],
    '7. Libraries':   [Progress_Bar, Plot, Table, Console_App, GUI, Scraping, Web, Profile],
    '8. Multimedia':  [NumPy, Image, Animation, Audio, Synthesizer, Pygame, Pandas, Plotly]
}

#Main

if __name__ == '__main__':      # Skips indented lines of code if file was imported.
    main()                      # Executes user-defined `def main(): ...` function.

#List

<list> = [<el_1>, <el_2>, ...]  # Creates new list object. E.g. `list_a = [1, 2, 3]`.
<el>   = <list>[index]          # First index is 0, last -1. Also `<list>[i] = <el>`.
<list> = <list>[<slice>]        # Also <list>[from_inclusive : to_exclusive : ±step].
<list>.append(<el>)             # Appends element to the end. Also `<list> += [<el>]`.
<list>.extend(<collection>)     # Appends multiple elements. Also `<list> += <coll>`.
<list>.sort(reverse=False)      # Sorts the elements of the list in ascending order.
<list>.reverse()                # Reverses the order of elements. Takes linear time.
<list> = sorted(<collection>)   # Returns a new sorted list. Accepts `reverse=True`.
<iter> = reversed(<list>)       # Returns reversed iterator. Also list(<iterator>).
<el>  = max(<collection>)       # Returns the largest element. Also min(<el_1>, ...).
<num> = sum(<collection>)       # Returns a sum of elements. Also math.prod(<coll>).
elementwise_sum  = [sum(pair) for pair in zip(list_a, list_b)]
sorted_by_second = sorted(<coll>, key=lambda pair: pair[1])
sorted_by_both   = sorted(<coll>, key=lambda p: (p[1], p[0]))
flatter_list     = list(itertools.chain.from_iterable(<list>))
  • For details about sort(), sorted(), min() and max() see Sortable.
  • Module operator has function itemgetter() that can replace listed lambdas.
  • This text uses the term collection instead of iterable. For rationale see duck types.
<int> = len(<list/dict/set/…>)  # Returns number of items. Doesn't accept iterators.
<int> = <list>.count(<el>)      # Counts occurrences. Also `if <el> in <coll>: ...`.
<int> = <list>.index(<el>)      # Returns index of first occ. or raises ValueError.
<el>  = <list>.pop()            # Removes item from the end (or at index if passed).
<list>.insert(<int>, <el>)      # Inserts item at index and shifts remaining items.
<list>.remove(<el>)             # Removes the first occurrence or raises ValueError.
<list>.clear()                  # Removes all items. Also provided by dict and set.

#Dictionary

<dict> = {key_1: val_1, key_2: val_2, ...}      # Use `<dict>[key]` to get or assign the value.
<view> = <dict>.keys()                          # A collection of keys reflecting all changes.
<view> = <dict>.values()                        # A collection of values that reflects changes.
<view> = <dict>.items()                         # Coll. of tuples. Each contains key and value.
value  = <dict>.get(key, default=None)          # Returns 'default' argument if key is missing.
value  = <dict>.setdefault(key, default=None)   # Returns and writes 'default' if key is amiss.
<dict> = collections.defaultdict(<type>)        # Dict with automatic default value `<type>()`.
<dict> = collections.defaultdict(lambda: 1)     # Dictionary with automatic default value `1`.
<dict> = dict(<collection>)                     # Creates a dict from coll. of key-value pairs.
<dict> = dict(zip(keys, values))                # Creates key-value pairs from two collections.
<dict> = dict.fromkeys(keys [, value])          # Items get value None if only keys are passed.
<dict>.update(<dict>)                           # Adds items to dict. Passed dict has priority.
value = <dict>.pop(key)                         # Removes item or raises KeyError when missing.
{k for k, v in <dict>.items() if v == 123}      # Returns a set of keys whose value equals 123.
{k: v for k, v in <dict>.items() if k in keys}  # Returns a dict of items with specified keys.

Counter

>>> from collections import Counter
>>> counter = Counter(['blue', 'blue', 'red'])
>>> counter['yellow'] += 3
>>> print(counter.most_common())
[('yellow', 3), ('blue', 2), ('red', 1)]

#Set

<set> = {<el_1>, <el_2>, ...}           # Coll. of unique items. Also set(), set(<coll>).
<set>.add(<el>)                         # Adds item to the set. Same as `<set> |= {<el>}`.
<set>.update(<collection> [, ...])      # Adds items to the set. Same as `<set> |= <set>`.
<set>  = <set>.union(<coll>)            # Returns a set of all items. Also <set> | <set>.
<set>  = <set>.intersection(<coll>)     # Returns every shared item. Also <set> & <set>.
<set>  = <set>.difference(<coll>)       # Returns set's unique items. Also <set> - <set>.
<set>  = <set>.symmetric_diff…(<coll>)  # Returns all nonshared items. Also <set> ^ <set>.
<bool> = <set>.issuperset(<coll>)       # Returns False when collection has unique items.
<bool> = <set>.issubset(<coll>)         # Is collection a superset? Also <set> <= <set>.
<el> = <set>.pop()                      # Removes one of items. Raises KeyError if empty.
<set>.remove(<el>)                      # Removes the item or raises KeyError if missing.
<set>.discard(<el>)                     # Same as remove() but it doesn't raise an error.

Frozen Set

  • Frozenset is immutable and hashable version of the normal set.
  • That means it can be used as a key in a dictionary or as an item in a set.
<frozenset> = frozenset(<collection>)

#Tuple

Tuple is an immutable and hashable list.

<tuple> = ()                        # Returns an empty tuple. Also tuple(), tuple(<coll>).
<tuple> = (<el>,)                   # Returns a tuple with single element. Same as `<el>,`.
<tuple> = (<el_1>, <el_2> [, ...])  # Returns a tuple. Same as `<el_1>, <el_2> [, ...]`.

Named Tuple

Tuple's subclass with named elements.

>>> from collections import namedtuple
>>> Point = namedtuple('Point', 'x y')
>>> p = Point(1, y=2)
>>> print(p)
Point(x=1, y=2)
>>> p.x, p[1]
(1, 2)

#Range

A sequence of evenly spaced integers.

<range> = range(stop)                # I.e. range(to_exclusive). Integers from 0 to `stop-1`.
<range> = range(start, stop)         # I.e. range(from_inc, to_exc). From start to `stop-1`.
<range> = range(start, stop, ±step)  # I.e. range(from_inclusive, to_exclusive, ±step_size).
>>> [i for i in range(3)]
[0, 1, 2]

#Enumerate

for i, el in enumerate(<coll>, start=0):  # Returns next element and its index on each pass.
    ...

#Iterator

Potentially endless stream of elements.

<iter> = iter(<collection>)              # Iterator that returns passed elements one by one.
<iter> = iter(<func>, to_exc)            # Calls `<func>()` until it receives 'to_exc' value.
<iter> = (<expr> for <name> in <coll>)   # E.g. `(i+1 for i in range(3))`. Evaluates lazily.
<el>   = next(<iter> [, default])        # Raises StopIteration or returns 'default' on end.
<list> = list(<iter>)                    # Returns a list of iterator's remaining elements.
  • For loops call 'iter(<collection>)' at the start and 'next(<iter>)' on each pass.
  • Calling 'iter(<iter>)' returns unmodified iterator. For details see Iterator duck type.
import itertools as it
<iter> = it.count(start=0, step=1)       # Returns updated 'start' endlessly. Accepts floats.
<iter> = it.repeat(<obj> [, times])      # Returns passed element endlessly or 'times' times.
<iter> = it.cycle(<collection>)          # Repeats the sequence endlessly. Accepts iterators.
<iter> = it.chain(<coll>, <coll>, ...)   # Returns each element of each collection in order.
<iter> = it.chain.from_iterable(<coll>)  # Accepts collection (i.e. iterable) of collections.
<iter> = it.islice(<coll>, stop)         # Also accepts 'start' and 'step'. Args can be None.
<iter> = it.product(<coll>, <coll>)      # Same as `((a, b) for a in arg_1 for b in arg_2)`.

#Generator

  • Any function that contains a yield statement returns a generator.
  • Generators and iterators are interchangeable.
def count(start, step):
    while True:
        yield start
        start += step
>>> counter = count(10, 2)
>>> next(counter), next(counter), next(counter)
(10, 12, 14)

#Type

  • Everything in Python is an object.
  • Every object has a certain type.
  • Type and class are synonymous.
<type> = type(<obj>)                  # Object's type. Same as `<obj>.__class__`.
<bool> = isinstance(<obj>, <type>)    # Same as `issubclass(type(<obj>), <type>)`.
>>> type('a'), 'a'.__class__, str
(<class 'str'>, <class 'str'>, <class 'str'>)

Some types do not have built-in names, so they must be imported:

from types import FunctionType, MethodType, LambdaType, GeneratorType

Abstract Base Classes

Each abstract base class specifies a set of virtual subclasses. These classes are then recognized by isinstance() and issubclass() as subclasses of the ABC, although they are really not. An ABC can also manually decide whether or not a specific class is its virtual subclass, usually based on which methods that class has implemented. For instance, Iterable ABC looks for method iter(), while Collection ABC looks for iter(), contains() and len().

>>> from collections.abc import Iterable, Collection, Sequence
>>> isinstance([1, 2, 3], Iterable)
True
┏━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━┓
┃                  │  Iterable  │ Collection │  Sequence  ┃
┠──────────────────┼────────────┼────────────┼────────────┨
┃ list, range, str │     ✓      │     ✓      │     ✓      ┃
┃ dict, set        │     ✓      │     ✓      │            ┃
┃ iter             │     ✓      │            │            ┃
┗━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┛
>>> from numbers import Number, Complex, Real, Rational, Integral
>>> isinstance(123, Number)
True
┏━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━┓
┃                    │   Number  │  Complex  │   Real   │ Rational │ Integral ┃
┠────────────────────┼───────────┼───────────┼──────────┼──────────┼──────────┨
┃ int                │     ✓     │     ✓     │    ✓     │    ✓     │    ✓     ┃
┃ fractions.Fraction │     ✓     │     ✓     │    ✓     │    ✓     │          ┃
┃ float              │     ✓     │     ✓     │    ✓     │          │          ┃
┃ complex            │     ✓     │     ✓     │          │          │          ┃
┃ decimal.Decimal    │     ✓     │           │          │          │          ┃
┗━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━┛

#String

Immutable sequence of characters.

<str>  = 'abc'                               # Also "abc". Interprets \n, \t, \x00-\xff, etc.
<str>  = <str>.strip()                       # Strips all whitespace characters from both ends.
<str>  = <str>.strip('<chars>')              # Strips passed characters. Also lstrip/rstrip().
<list> = <str>.split()                       # Splits it on one or more whitespace characters.
<list> = <str>.split(sep=None, maxsplit=-1)  # Splits on 'sep' string at most 'maxsplit' times.
<list> = <str>.splitlines(keepends=False)    # On [\n\r\f\v\x1c-\x1e\x85\u2028\u2029] and \r\n.
<str>  = <str>.join(<coll_of_strings>)       # Joins items by using the string as a separator.
<bool> = <sub_str> in <str>                  # Returns True if string contains the substring.
<bool> = <str>.startswith(<sub_str>)         # Pass tuple of strings to give multiple options.
<int>  = <str>.find(<sub_str>)               # Returns start index of the first match or `-1`.
<str>  = <str>.lower()                       # Lowers the case. Also upper/capitalize/title().
<str>  = <str>.casefold()                    # Lower() that converts ẞ/ß to ss, Σ/ς to σ, etc.
<str>  = <str>.replace(old, new [, count])   # Replaces 'old' with 'new' at most 'count' times.
<str>  = <str>.translate(table)              # Use `str.maketrans(<dict>)` to generate table.
<str>  = chr(<int>)                          # Converts passed integer into Unicode character.
<int>  = ord(<str>)                          # Converts passed Unicode character into integer.
  • Use 'unicodedata.normalize("NFC", <str>)' on strings like 'Motörhead' before comparing them to other strings, because 'ö' can be stored as one or two characters.
  • 'NFC' converts such characters to a single character, while 'NFD' converts them to two.
<bool> = <str>.isdecimal()                   # Checks all chars for [0-9]. Also [०-९], [٠-٩].
<bool> = <str>.isdigit()                     # Checks for [²³¹…] and isdecimal(). Also [፩-፱].
<bool> = <str>.isnumeric()                   # Checks for [¼½¾…] and isdigit(). Also [零〇一…].
<bool> = <str>.isalnum()                     # Checks for [ABC…] and isnumeric(). Also [ªµº…].
<bool> = <str>.isprintable()                 # Checks for [ !"#…], basic emojis and isalnum().
<bool> = <str>.isspace()                     # Checks for [ \t\n\r\f\v\x1c\x1d\x1e\x1f\x85…].

#Regex

Functions for regular expression matching.

import re
<str>   = re.sub(r'<regex>', new, text)  # Substitutes occurrences with string 'new'.
<list>  = re.findall(r'<regex>', text)   # Returns all occurrences as string objects.
<list>  = re.split(r'<regex>', text)     # Add brackets around regex to keep matches.
<Match> = re.search(r'<regex>', text)    # Returns first occ. of the pattern or None.
<Match> = re.match(r'<regex>', text)     # Only searches at the start of the 'text'.
<iter>  = re.finditer(r'<regex>', text)  # Returns all occurrences as Match objects.
  • Raw string literals do not interpret escape sequences, thus enabling us to use the regex-specific escape sequences that cause SyntaxWarning in normal string literals (since 3.12).
  • Argument 'new' can also be a function that accepts a Match object and returns a string.
  • Argument 'flags=re.IGNORECASE' can be used with all functions that are listed above.
  • Argument 'flags=re.MULTILINE' makes '^' and '$' match the start/end of each line.
  • Argument 'flags=re.DOTALL' makes '.' also accept the '\n' (besides all other chars).
  • 're.compile(r"<regex>")' returns a Pattern object with methods sub(), findall(), etc.

Match Object

<str>   = <Match>.group()                # Returns the whole match. Also group(0).
<str>   = <Match>.group(1)               # Returns part inside the first brackets.
<tuple> = <Match>.groups()               # Returns all bracketed parts as strings.
<int>   = <Match>.start()                # Returns start index of the whole match.
<int>   = <Match>.end()                  # Returns the match's end index plus one.

Special Sequences

'\d' == '[0-9]'                          # Also [०-९…]. Matches decimal character.
'\w' == '[a-zA-Z0-9_]'                   # Also [ª²³…]. Matches alphanumeric or _.
'\s' == '[ \t\n\r\f\v]'                  # Also [\x1c-\x1f…]. Matches whitespace.
  • By default, decimal characters and alphanumerics from all alphabets are matched unless 'flags=re.ASCII' is used. It restricts special sequence matches to the first 128 Unicode characters and also prevents '\s' from accepting '\x1c', '\x1d', '\x1e' and '\x1f' (non-printable characters that divide text into files, tables, rows and fields, respectively).
  • Use a capital letter, i.e. '\D', '\W' or '\S', for negation. All non-ASCII characters are matched if ASCII flag is used in conjunction with a capital letter.

#Format

<str> = f'{<obj>}, {<obj>}'            # Curly brackets can contain any expression.
<str> = '{}, {}'.format(<obj>, <obj>)  # Same as '{0}, {a}'.format(<obj>, a=<obj>).
<str> = '%s, %s' % (<obj>, <obj>)      # Redundant and inferior C-style formatting.

Example

>>> Person = collections.namedtuple('Person', 'name height')
>>> person = Person('Jean-Luc', 187)
>>> f'{person.name} is {person.height / 100} meters tall.'
'Jean-Luc is 1.87 meters tall.'

General Options

{<obj>:<10}                            # '<obj>     '.
{<obj>:^10}                            # '  <obj>   '.
{<obj>:>10}                            # '     <obj>'.
{<obj>:.<10}                           # '<obj>.....'.
{<obj>:0}                              # '<obj>'.
  • Objects are converted to strings with format() function, e.g. 'format(<obj>, "<10")'.
  • Options can be generated dynamically via nested braces: f'{<obj>:{<str/int>}[…]}'.
  • Adding '=' to the expression prepends it to its result, e.g. f'{1+1=}' returns '1+1=2'.
  • Adding '!r' to the expression first calls result's repr() method and only then format().

Strings

{'abcde':10}                           # 'abcde     '.
{'abcde':10.3}                         # 'abc       '.
{'abcde':.3}                           # 'abc'.
{'abcde'!r:10}                         # "'abcde'   ".

Numbers

{123456:10}                            # '    123456'.
{123456:10,}                           # '   123,456'.
{123456:10_}                           # '   123_456'.
{123456:+10}                           # '   +123456'.
{123456:=+10}                          # '+   123456'.
{123456: }                             # ' 123456'.
{-123456: }                            # '-123456'.

Floats

{1.23456:10.3}                         # '      1.23'.
{1.23456:10.3f}                        # '     1.235'.
{1.23456:10.3e}                        # ' 1.235e+00'.
{1.23456:10.3%}                        # '  123.456%'.

Comparison of presentation types:

┏━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┓
┃              │    {<float>}   │   {<float>:f}  │   {<float>:e}  │   {<float>:%}  ┃
┠──────────────┼────────────────┼────────────────┼────────────────┼────────────────┨
┃  0.000056789 │   '5.6789e-05' │    '0.000057'  │ '5.678900e-05' │    '0.005679%' ┃
┃  0.00056789  │   '0.00056789' │    '0.000568'  │ '5.678900e-04' │    '0.056789%' ┃
┃  0.0056789   │   '0.0056789'  │    '0.005679'  │ '5.678900e-03' │    '0.567890%' ┃
┃  0.056789    │   '0.056789'   │    '0.056789'  │ '5.678900e-02' │    '5.678900%' ┃
┃  0.56789     │   '0.56789'    │    '0.567890'  │ '5.678900e-01' │   '56.789000%' ┃
┃  5.6789      │   '5.6789'     │    '5.678900'  │ '5.678900e+00' │  '567.890000%' ┃
┃ 56.789       │  '56.789'      │   '56.789000'  │ '5.678900e+01' │ '5678.900000%' ┃
┗━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┛

┏━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┓
┃              │  {<float>:.2}  │  {<float>:.2f} │  {<float>:.2e} │  {<float>:.2%} ┃
┠──────────────┼────────────────┼────────────────┼────────────────┼────────────────┨
┃  0.000056789 │    '5.7e-05'   │      '0.00'    │   '5.68e-05'   │      '0.01%'   ┃
┃  0.00056789  │    '0.00057'   │      '0.00'    │   '5.68e-04'   │      '0.06%'   ┃
┃  0.0056789   │    '0.0057'    │      '0.01'    │   '5.68e-03'   │      '0.57%'   ┃
┃  0.056789    │    '0.057'     │      '0.06'    │   '5.68e-02'   │      '5.68%'   ┃
┃  0.56789     │    '0.57'      │      '0.57'    │   '5.68e-01'   │     '56.79%'   ┃
┃  5.6789      │    '5.7'       │      '5.68'    │   '5.68e+00'   │    '567.89%'   ┃
┃ 56.789       │    '5.7e+01'   │     '56.79'    │   '5.68e+01'   │   '5678.90%'   ┃
┗━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┛
  • '{<num>:g}' is '{<float>:.6}' that strips '.0' and has exponent starting at '1e+06'.
  • When both rounding up and rounding down are possible, the one that returns result with even last digit is chosen. Hence '{6.5:.0f}' becomes a '6', while '{7.5:.0f}' an '8'.
  • The last rule only effects numbers that can be represented exactly by a float (.5, .25, …).

Ints

{90:c}                                 # Converts 90 to Unicode character 'Z'.
{90:b}                                 # Converts 90 to binary number '1011010'.
{90:X}                                 # Converts 90 to hexadecimal number '5A'.

#Numbers

<int>      = int(<float/str/bool>)             # A whole number. Truncates floats.
<float>    = float(<int/str/bool>)             # 64-bit decimal. Also <fl>e±<int>.
<complex>  = complex(real=0, imag=0)           # Complex number. Also <fl> ± <fl>j.
<Fraction> = fractions.Fraction(numer, denom)  # `<Fraction> = <Fraction> / <int>`.
<Decimal>  = decimal.Decimal(<str/int/tuple>)  # `Decimal((1, (2,), 3)) == -2000`.
  • 'int(<str>)' and 'float(<str>)' raise ValueError exception if string is malformed.
  • Decimal objects store numbers exactly, unlike most floats where '1.1 + 2.2 != 3.3'.
  • Floats can be compared with: 'math.isclose(<float>, <float>, rel_tol=1e-9)'.
  • Precision of decimal operations is set with: 'decimal.getcontext().prec = <int>'.
  • Bools can be used anywhere ints can, since bool is a subclass of int: 'True + 1 == 2'.

Built-in Functions

<num> = pow(<num>, <num>)                      # E.g. `pow(3, 4) == 3 ** 4 == 81`.
<num> = abs(<num>)                             # E.g. `abs(-50) == abs(50) == 50`.
<num> = round(<num> [, ±ndigits])              # E.g. `round(123.45, -1) == 120`.
<num> = min(<coll_of_nums>)                    # Also `max(<num>, <num> [, ...])`.
<num> = sum(<coll_of_nums>)                    # Also `math.prod(<coll_of_nums>)`.

Math

from math import floor, ceil, trunc            # Funcs that convert float into int.
from math import pi, inf, nan, isnan           # `inf*0` and `nan+1` return `nan`.
from math import sqrt, factorial               # `sqrt(-1)` will raise ValueError.
from math import sin, cos, tan                 # Also: degrees, radians, asin, etc.
from math import log, log10, log2              # Log() can accept 'base' argument.

Statistics

from statistics import mean, median, mode      # Mode returns most common element.
from statistics import variance, stdev         # Also `cuts = quantiles(data, n)`.

Random

from random import random, randint, uniform    # Also: gauss, choice, shuffle, etc.
<float> = random()                             # Selects random float from [0, 1).
<num>   = randint/uniform(a, b)                # Selects an int/float from [a, b].
<float> = gauss(mean, stdev)                   # Also triangular(low, high, mode).
<el>    = choice(<sequence>)                   # Doesn't modify. Also sample(p, n).
shuffle(<list>)                                # Works with all mutable sequences.

Hexadecimal Numbers

<int> = 0x<hex>                                # E.g. `0xFf == 255`. Also 0b<bin>.
<int> = int('±<hex>', 16)                      # Also int('±0x<hex>/±0b<bin>', 0).
<str> = hex(<int>)                             # Returns '[-]0x<hex>'. Also bin().

Bitwise Operators

<int> = <int> & <int>                          # E.g. `0b1100 & 0b1010 == 0b1000`.
<int> = <int> | <int>                          # E.g. `0b1100 | 0b1010 == 0b1110`.
<int> = <int> ^ <int>                          # E.g. `0b1100 ^ 0b1010 == 0b0110`.
<int> = <int> << n_bits                        # E.g. `0b1111 << 4 == 0b11110000`.
<int> = ~<int>                                 # E.g. `~0b1 == -(0b1+1) == -0b10`.

#Combinatorics

import itertools as it
>>> list(it.product('abc', repeat=2))        #   a  b  c
[('a', 'a'), ('a', 'b'), ('a', 'c'),         # a x  x  x
 ('b', 'a'), ('b', 'b'), ('b', 'c'),         # b x  x  x
 ('c', 'a'), ('c', 'b'), ('c', 'c')]         # c x  x  x
>>> list(it.permutations('abc', 2))          #   a  b  c
[('a', 'b'), ('a', 'c'),                     # a .  x  x
 ('b', 'a'), ('b', 'c'),                     # b x  .  x
 ('c', 'a'), ('c', 'b')]                     # c x  x  .
>>> list(it.combinations('abc', 2))          #   a  b  c
[('a', 'b'), ('a', 'c'),                     # a .  x  x
 ('b', 'c')                                  # b .  .  x
]                                            # c .  .  .

#Datetime

Provides 'date', 'time', 'datetime' and 'timedelta' classes. All are immutable and hashable.

# $ pip3 install python-dateutil
from datetime import date, time, datetime, timedelta, timezone
import zoneinfo, dateutil.tz
<D>  = date(year, month, day)               # Only accepts valid dates between AD 1 and 9999.
<T>  = time(hour=0, minute=0, second=0)     # Accepts `microsecond=0, tzinfo=None, fold=0`.
<DT> = datetime(year, month, day, hour=0)   # Accepts `minute=0, second=0, microsecond=0, …`.
<TD> = timedelta(weeks=0, days=0, hours=0)  # Accepts `minutes=0, seconds=0, microseconds=0`.
  • Times and datetimes that have defined timezone are called aware and ones that don't, naive. If time or datetime object is naive, it is presumed to be in the system's timezone.
  • 'fold=1' means the second pass in case of time jumping back (usually for one hour).
  • Timedelta normalizes arguments to ±days, seconds (< 86 400) and microseconds (< 1M). Its str() method returns '[±D, ]H:MM:SS[.…]' and total_seconds() a float of seconds.
  • Use '<D/DT>.weekday()' to get the day of the week as an int (with Monday being 0).

Now

<D/DTn> = D/DT.today()                      # Current local date or naive DT. Also DT.now().
<DTa>   = DT.now(<tzinfo>)                  # Aware DT from current time in passed timezone.
  • To extract time use '<DTn>.time()', '<DTa>.time()' or '<DTa>.timetz()'.

Timezones

<tzinfo> = timezone.utc                     # Coordinated universal time. London without DST.
<tzinfo> = timezone(<timedelta>)            # Timezone with fixed offset from universal time.
<tzinfo> = dateutil.tz.tzlocal()            # Local timezone with dynamic offset from the UTC.
<tzinfo> = zoneinfo.ZoneInfo('<iana_key>')  # 'Continent/City_Name' zone with dynamic offset.
<DTa>    = <DT>.astimezone([<tzinfo>])      # Converts DT to the passed or local fixed zone.
<Ta/DTa> = <T/DT>.replace(tzinfo=<tzinfo>)  # Changes the timezone object without conversion.
  • Timezones returned by tzlocal(), ZoneInfo(), and implicit local timezone of naive objects have offsets that vary through time due to DST and historical changes of the base offset.
  • To get ZoneInfo() to work on Windows run '> pip3 install tzdata'.

Encode

<D/T/DT> = D/T/DT.fromisoformat(<str>)      # Object from the ISO string. Raises ValueError.
<DT>     = DT.strptime(<str>, '<format>')   # Naive or aware datetime from the custom string.
<D/DTn>  = D/DT.fromordinal(<int>)          # Date or DT from days since the Gregorian NYE 1.
<DTn>    = DT.fromtimestamp(<float>)        # A local naive DT from seconds since the epoch.
<DTa>    = DT.fromtimestamp(<float>, <tz>)  # An aware datetime from seconds since the epoch.
  • ISO strings come in following forms: 'YYYY-MM-DD', 'HH:MM:SS.mmmuuu[±HH:MM]', or both separated by an arbitrary character. All parts following the hours are optional.
  • Python uses the Unix epoch: '1970-01-01 00:00 UTC', '1970-01-01 01:00 CET', …

Decode

<str>    = <D/T/DT>.isoformat(sep='T')      # Also `timespec='auto/hours/minutes/seconds/…'`.
<str>    = <D/T/DT>.strftime('<format>')    # Returns custom string representation of object.
<int>    = <D/DT>.toordinal()               # Days since NYE 1, ignoring DT's time and zone.
<float>  = <DTn>.timestamp()                # Seconds since the epoch from a local naive DT.
<float>  = <DTa>.timestamp()                # Seconds since the epoch from an aware datetime.

Format

>>> dta = datetime.strptime('2025-08-14 23:39:00.00 +0200', '%Y-%m-%d %H:%M:%S.%f %z')
>>> dta.strftime("%dth of %B '%y (%a), %I:%M %p %Z")
"14th of August '25 (Thu), 11:39 PM UTC+02:00"
  • '%z' accepts '±HH[:]MM' and returns '±HHMM' or empty string if object is naive.
  • '%Z' accepts 'UTC/GMT' and local timezone's code and returns timezone's name, 'UTC[±HH:MM]' if timezone is nameless, or an empty string if object is naive.

Arithmetics

<bool>   = <D/T/DTn> > <D/T/DTn>            # Ignores time jumps (fold attribute). Also `==`.
<bool>   = <DTa>     > <DTa>                # Ignores time jumps if they share tzinfo object.
<TD>     = <D/DTn>   - <D/DTn>              # Ignores jumps. Convert to UTC for actual delta.
<TD>     = <DTa>     - <DTa>                # Ignores jumps if they share the tzinfo object.
<D/DT>   = <D/DT>    ± <TD>                 # Returned datetime can fall into a missing hour.
<TD>     = <TD>      * <float>              # Also `<TD> = <TD> ± <TD>`, `<TD> = abs(<TD>)`.
<float>  = <TD>      / <TD>                 # Calling divmod(<TD>, <TD>) returns int and TD.

#Function

Independent block of code that returns a value when called.

def <func_name>(<nondefault_args>): ...                  # E.g. `func(x, y):`.
def <func_name>(<default_args>): ...                     # E.g. `func(x=0, y=0):`.
def <func_name>(<nondefault_args>, <default_args>): ...  # E.g. `func(x, y=0):`.
  • Function returns None if it doesn't encounter the 'return <object/expr>' statement.
  • Run 'global <var_name>' inside the function before assigning to the global variable.
  • Value of a default argument is evaluated when function is first encountered in the scope.
  • Any mutation of a default argument value will persist between function invocations!

Function Call

<obj> = <function>(<positional_args>)                    # E.g. `func(0, 0)`.
<obj> = <function>(<keyword_args>)                       # E.g. `func(x=0, y=0)`.
<obj> = <function>(<positional_args>, <keyword_args>)    # E.g. `func(0, y=0)`.

#Splat Operator

Splat expands a collection into positional arguments, while splatty-splat expands a dictionary into keyword arguments.

args, kwargs = (1, 2), {'z': 3}
func(*args, **kwargs)

Is the same as:

func(1, 2, z=3)

Inside Function Definition

Splat combines zero or more positional arguments into a tuple, while splatty-splat combines zero or more keyword arguments into a dictionary.

def add(*a):
    return sum(a)
>>> add(1, 2, 3)
6

Allowed compositions of arguments and the ways they can be called:

┏━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━┓
┃                           │ func(x=1, y=2) │ func(1, y=2) │  func(1, 2)  ┃
┠───────────────────────────┼────────────────┼──────────────┼──────────────┨
┃ func(x, *args, **kwargs): │       ✓        │      ✓       │      ✓       ┃
┃ func(*args, y, **kwargs): │       ✓        │      ✓       │              ┃
┃ func(*, x, **kwargs):     │       ✓        │              │              ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━┛

Other Uses

<list>  = [*<collection> [, ...]]  # Same as `list(<coll>) [+ ...]`.
<tuple> = (*<collection>, [...])   # Same as `tuple(<coll>) [+ ...]`.
<set>   = {*<collection> [, ...]}  # Same as `set(<coll>) [| ...]`.
<dict>  = {**<dict> [, ...]}       # Last dict has priority. Also |.
head, *body, tail = <collection>   # Head or tail can be omitted.

#Inline

Lambda

<func> = lambda: <return_value>                    # A single statement function.
<func> = lambda <arg_1>, <arg_2>: <return_value>   # Also allows default arguments.

Comprehensions

<list> = [i+1 for i in range(5)]                   # Returns `[1, 2, 3, 4, 5]`.
<iter> = (i for i in range(10) if i > 5)           # Returns `iter([6, 7, 8, 9])`.
<set>  = {i+5 for i in range(5)}                   # Returns `{5, 6, 7, 8, 9}`.
<dict> = {i: i**2 for i in range(1, 4)}            # Returns `{1: 1, 2: 4, 3: 9}`.
>>> [l+r for l in 'abc' for r in 'abc']            # Inner loop is on right side.
['aa', 'ab', 'ac', ..., 'cc']

Map, Filter, Reduce

from functools import reduce
<iter> = map(lambda x: x + 1, range(5))            # Returns `iter([1, 2, 3, 4, 5])`.
<iter> = filter(lambda x: x > 5, range(10))        # Returns `iter([6, 7, 8, 9])`.
<obj>  = reduce(lambda out, x: out + x, range(5))  # Returns 10. Accepts 'initial'.

Any, All

<bool> = any(<collection>)                         # Is bool(<el>) True for any el?
<bool> = all(<collection>)                         # Is it True for all (or empty)?

Conditional Expression

<obj> = <exp> if <condition> else <exp>            # Evaluates only one expression.
>>> [i if i else 'zero' for i in (0, 1, 2, 3)]     # `any(['', [], None])` is False.
['zero', 1, 2, 3]

And, Or

<obj> = <exp> and <exp> [and ...]                  # Returns first false or last obj.
<obj> = <exp> or <exp> [or ...]                    # Returns first true or last obj.

Walrus Operator

>>> [i for ch in '0123' if (i := int(ch)) > 0]     # Assigns to var in mid-sentence.
[1, 2, 3]

Named Tuple, Enum, Dataclass

from collections import namedtuple
Point = namedtuple('Point', 'x y')                 # Creates tuple's subclass.
point = Point(0, 0)                                # Returns its instance.

from enum import Enum
Direction = Enum('Direction', 'N E S W')           # Creates an enumeration.
direction = Direction.N                            # Returns its member.

from dataclasses import make_dataclass
Player = make_dataclass('Player', ['loc', 'dir'])  # Creates a normal class.
player = Player(point, direction)                  # Returns its instance.

#Imports

Mechanism that makes code in one file available to another file.

import <module>                      # Imports a built-in module or the '<module>.py'.
import <package>                     # A built-in package or '<package>/__init__.py'.
import <package>.<module>            # A package's module or '<package>/<module>.py'.
from <pkg/mod>[.…] import <obj>      # Imports a module, function, class or variable.
  • Package is a collection of modules, but it can also define its own functions, variables, etc. On a filesystem this corresponds to a directory of Python files with an optional init script.
  • 'import <package>' only exposes modules that are imported inside '__init__.py'.
  • Directory of the file that is passed to python command serves as the root of local imports.
  • Use relative imports, i.e. 'from .[…][<pkg/mod>[.…]] import <obj>', if project has scattered entry points. Another option is to install the whole project by moving its code into 'src' dir, adding 'pyproject.toml' to its root, and running '$ pip3 install -e .'.

#Closure

We have/get a closure in Python when a nested function references a value of its enclosing function and then the enclosing function returns its nested function (any value that is ref­erenced from within multiple nested functions gets shared).

def get_multiplier(a):
    def out(b):
        return a * b
    return out
>>> multiply_by_3 = get_multiplier(3)
>>> multiply_by_3(10)
30

Partial

from functools import partial
<function> = partial(<function> [, <arg_1> [, ...]])
>>> def multiply(a, b):
...     return a * b
>>> multiply_by_3 = partial(multiply, 3)
>>> multiply_by_3(10)
30
  • Partial is also useful in cases when a function needs to be passed as an argument because it enables us to set its arguments beforehand ('collections.defaultdict(<func>)', 'iter(<func>, to_exc)' and 'dataclasses.field(default_factory=<func>)').

Non-Local

If variable is being assigned to anywhere in the scope (i.e., body of a function), it is treated as a local variable unless it is declared 'global' or 'nonlocal' before its first usage.

def get_counter():
    i = 0
    def out():
        nonlocal i
        i += 1
        return i
    return out
>>> counter = get_counter()
>>> counter(), counter(), counter()
(1, 2, 3)

#Decorator

A decorator takes a function, adds some functionality and returns it. It can be any callable, but is usually implemented as a function that returns a closure.

@decorator_name
def function_that_gets_passed_to_decorator():
    ...

Debugger Example

Decorator that prints function's name every time that function is called.

from functools import wraps

def debug(func):
    @wraps(func)
    def out(*args, **kwargs):
        print(func.__name__)
        return func(*args, **kwargs)
    return out

@debug
def add(x, y):
    return x + y
  • Wraps is a helper decorator that copies the metadata of the passed function (func) to the function it is decorating (out). Without it, 'add.__name__' would return string 'out'.

Cache

Decorator that stores return values. All arguments must be hashable.

from functools import cache

@cache
def fibonacci(n):
    return n if n < 2 else fibonacci(n-2) + fibonacci(n-1)
  • Potential problem with cache is that it can grow indefinitely. To clear stored values run '<func>.cache_clear()', or use '@lru_cache(maxsize=<int>)' decorator instead.
  • CPython interpreter limits recursion depth to 3000 by default. To increase this limit run 'sys.setrecursionlimit(<int>)'.

Parametrized Decorator

Decorator that accepts arguments and returns a normal decorator.

from functools import wraps

def debug(print_result=False):
    def decorator(func):
        @wraps(func)
        def out(*args, **kwargs):
            result = func(*args, **kwargs)
            print(func.__name__, result if print_result else '')
            return result
        return out
    return decorator

@debug(print_result=True)
def add(x, y):
    return x + y
  • Using only '@debug' to decorate the add() function would not work here, because debug would then receive the add() function as a 'print_result' argument. Decorators can how­ever manually check if the argument they received is a function and act accordingly.

#Class

A template for creating user-defined objects.

class MyClass:
    def __init__(self, a):
        self.a = a
    def __str__(self):
        return str(self.a)
    def __repr__(self):
        class_name = self.__class__.__name__
        return f'{class_name}({self.a!r})'

    @classmethod
    def get_class_name(cls):
        return cls.__name__
>>> obj = MyClass(1)
>>> obj.a, str(obj), repr(obj)
(1, '1', 'MyClass(1)')
  • Methods whose names start and end with two underscores are called special methods. They are executed when object is passed to a built-in function or used as an operand. For example, 'print(a)' calls 'a.__str__()' and 'a + b' calls 'a.__add__(b)'.
  • Methods that are decorated with '@staticmethod' receive neither 'self' nor 'cls' arg.
  • Return value of str() special method should be readable and of repr() unambiguous.
  • All calls to str() special method are dispatched to repr() when only repr() is provided.

Expressions that call the str() special method:

f'{obj}'
print(obj)
logging.warning(obj)
<csv_writer>.writerow([obj])

Expressions that call the repr() special method:

f'{obj!r}'
print/str/repr([obj])
print/str/repr({obj: obj})
print/str/repr(MyDataClass(obj))

Subclass

  • Inheritance is a mechanism that enables a class to extend some other class (i.e. sub­class to extend its parent), and by doing so inherit all of its methods and attributes.
  • Subclass can then add its own methods and attributes or override inherited ones by reusing their names.
class Person:
    def __init__(self, name):
        self.name = name
    def __repr__(self):
        return f'Person({self.name!r})'
    def __lt__(self, other):
        return self.name < other.name

class Employee(Person):
    def __init__(self, name, staff_num):
        super().__init__(name)
        self.staff_num = staff_num
    def __repr__(self):
        return f'Employee({self.name!r}, {self.staff_num})'
>>> people = [Person('Bob'), Employee('Ann', 0)]
>>> sorted(people)
[Employee('Ann', 0), Person('Bob')]

Type Annotations

  • They add type hints to variables, arguments and functions ('def f() -> <type>:').
  • Hints are used by type checkers like mypy, data validation libraries such as Pydantic and lately also by Cython compiler. However, they are not enforced by CPython interpreter.
from collections import abc

<name>: <type> [| ...] [= <obj>]
<name>: list/set/abc.Iterable/abc.Sequence[<type>] [= <obj>]
<name>: tuple/dict[<type>, ...] [= <obj>]

Dataclass

Decorator that uses class variables to generate init(), repr() and eq() special methods.

from dataclasses import dataclass, field, make_dataclass

@dataclass(order=False, frozen=False)
class <class_name>:
    <attr_name>: <type>
    <attr_name>: <type> = <default_value>
    <attr_name>: list/dict/set = field(default_factory=list/dict/set)
  • Objects can be made sortable with 'order=True' and immutable with 'frozen=True'.
  • For object to be hashable, all attributes must be hashable and 'frozen' must be 'True'.
  • Function field() is needed because '<attr_name>: list = []' would make a list that is shared among all instances. Its 'default_factory' argument accepts any callable object.
  • For attributes/arguments of arbitrary type use 'typing.Any'.

Inline:

P = make_dataclass('P', ['x', 'y'])
P = make_dataclass('P', [('x', float), ('y', float)])
P = make_dataclass('P', [('x', float, 0), ('y', float, 0)])

Property

Pythonic way of implementing getters and setters.

class Person:
    @property
    def name(self):
        return ' '.join(self._name)

    @name.setter
    def name(self, value):
        self._name = value.split()
>>> person = Person()
>>> person.name = '\t Guido  van Rossum \n'
>>> person.name
'Guido van Rossum'

Slots

Mechanism that restricts objects to listed attributes.

class Point:
    __slots__ = ['x', 'y']

Copy

from copy import copy, deepcopy
<object> = copy/deepcopy(<object>)

#Duck Types

A duck type is an implicit type that prescribes a set of special methods. Any object that has those methods defined is considered a member of that duck type.

Comparable

  • If eq() method is not overridden, it returns 'id(self) == id(other)', which is the same as 'self is other'. That means all user-defined objects compare not equal by default (because id() returns object's memory address that is guaranteed to be unique).
  • Only the left side object has eq() method called, unless it returns NotImplemented, in which case the right object is consulted. Result is False if both return NotImplemented.
  • Method ne() (called by '!=') automatically works on any object that has eq() defined.
class MyComparable:
    def __init__(self, a):
        self.a = a
    def __eq__(self, other):
        if isinstance(other, type(self)):
            return self.a == other.a
        return NotImplemented

Hashable

  • Hashable object needs hash() and eq() methods and its hash value must never change.
  • Hashable objects that compare equal must have the same hash value, meaning default hash() that returns 'id(self)' will not do. That is why Python automatically makes classes unhashable if you only implement the eq() method.
class MyHashable:
    def __init__(self, a):
        self._a = a
    @property
    def a(self):
        return self._a
    def __eq__(self, other):
        if isinstance(other, type(self)):
            return self.a == other.a
        return NotImplemented
    def __hash__(self):
        return hash(self.a)

Sortable

  • With 'total_ordering' decorator, you only need to provide eq() and one of lt(), gt(), le() or ge() special methods (called by <, >, <=, >=) and the rest will be automatically generated.
  • Built-in functions sorted() and min() only require lt() method, while max() only requires gt(). However, it's best to define them all so that confusion doesn't arise in other contexts.
  • When two lists, strings, or data classes are compared, their values get compared one by one until a pair of unequal values is found. The comparison of this two values is then re­turned. The shorter sequence is considered smaller in case of all their values being equal.
  • To sort collection of strings in proper alphabetical order pass 'key=locale.strxfrm' to sorted() after running 'locale.setlocale(locale.LC_COLLATE, "en_US.UTF-8")'.
from functools import total_ordering

@total_ordering
class MySortable:
    def __init__(self, a):
        self.a = a
    def __eq__(self, other):
        if isinstance(other, type(self)):
            return self.a == other.a
        return NotImplemented
    def __lt__(self, other):
        if isinstance(other, type(self)):
            return self.a < other.a
        return NotImplemented

Iterator

  • Any object that has methods next() and iter() is an iterator.
  • Next() should return next item or raise StopIteration exception.
  • Iter() should return unmodified iterator, i.e. the 'self' argument.
  • Any object that has iter() method can be used in a for loop.
class Counter:
    def __init__(self):
        self.i = 0
    def __next__(self):
        self.i += 1
        return self.i
    def __iter__(self):
        return self
>>> counter = Counter()
>>> next(counter), next(counter), next(counter)
(1, 2, 3)

Python has many different iterator objects:

Callable

  • All functions and classes have a call() method that is executed when they are called.
  • Use 'callable(<obj>)' or 'isinstance(<obj>, collections.abc.Callable)' to check if object is callable. You can also call the object and see if it raised TypeError.
  • When this text uses '<function>' as an argument, it actually means '<callable>'.
class Counter:
    def __init__(self):
        self.i = 0
    def __call__(self):
        self.i += 1
        return self.i
>>> counter = Counter()
>>> counter(), counter(), counter()
(1, 2, 3)

Context Manager

  • With statements only work on objects that have enter() and exit() special methods.
  • Enter() should lock the resources and optionally return an object (file, socket, etc.).
  • Exit() should release the resources (for example close the file, release the lock, etc.).
  • Any exception that happens inside the with block is passed to exit() method. Exit() can then suppress this exception by returning a true value (not None, False, 0, etc.).
class MyOpen:
    def __init__(self, filename):
        self.filename = filename
    def __enter__(self):
        self.file = open(self.filename)
        return self.file
    def __exit__(self, exc_type, exception, traceback):
        self.file.close()
>>> with open('test.txt', 'w') as file:
...     file.write('Hello World!')
>>> with MyOpen('test.txt') as file:
...     print(file.read())
Hello World!

#Iterable Duck Types

Iterable

  • Only required method is iter(). It should return an iterator of object's items.
  • Method contains() automatically works on any object that has iter() defined.
class MyIterable:
    def __init__(self, a):
        self.a = a
    def __iter__(self):
        return iter(self.a)
    def __contains__(self, el):
        return el in self.a
>>> obj = MyIterable([1, 2, 3])
>>> [el for el in obj]
[1, 2, 3]
>>> 1 in obj
True

Collection

  • Only required methods are iter() and len(). Len() should return the length of collection.
  • This text refers to all iterable objects as collections, which is technically incorrect. The term iterable was avoided because it sounds scarier and more vague than collection. The main drawback of this decision is that the reader could think a certain function doesn't accept iterators when it actually does, since iterators are the only built-in objects that are iterable but are not collections.
class MyCollection:
    def __init__(self, a):
        self.a = a
    def __iter__(self):
        return iter(self.a)
    def __contains__(self, el):
        return el in self.a
    def __len__(self):
        return len(self.a)

Sequence

  • Only required methods are getitem() and len(). Getitem() should return an item at the passed index or raise IndexError (it may also support negative indices and/or slices).
  • Iter() and contains() automatically work on any object with defined getitem() method.
  • Reversed() automatically works on any object that has getitem() and len() defined. It returns reversed iterator of object's items.
class MySequence:
    def __init__(self, a):
        self.a = a
    def __iter__(self):
        return iter(self.a)
    def __contains__(self, el):
        return el in self.a
    def __len__(self):
        return len(self.a)
    def __getitem__(self, i):
        return self.a[i]
    def __reversed__(self):
        return reversed(self.a)

Discrepancies between glossary definitions and abstract base classes:

  • Python's glossary defines iterable as any object with special methods iter() or getitem(), and sequence as any object with getitem() and len(). It doesn't define the term collection.
  • Passing ABC Iterable to isinstance() or issubclass() only checks whether object/class has special method iter(), while ABC Collection checks for iter(), contains() and len().

ABC Sequence

  • It's a richer interface than the basic sequence that also requires just getitem() and len().
  • Extending it generates iter(), contains(), reversed(), index() and count() special methods.
  • Unlike 'abc.Iterable' and 'abc.Collection', it is not a duck type. That is why exp. 'issubclass(MySequence, abc.Sequence)' would return False even if MySequence had all methods defined. It however recognizes list, tuple, range, string, bytes, bytearray, array, memoryview and deque, since they are registered as Sequence's virtual subclasses.
from collections import abc

class MyAbcSequence(abc.Sequence):
    def __init__(self, a):
        self.a = a
    def __len__(self):
        return len(self.a)
    def __getitem__(self, i):
        return self.a[i]

Table of required and automatically available special methods:

┏━━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━┓
┃            │  Iterable  │ Collection │  Sequence  │ abc.Sequence ┃
┠────────────┼────────────┼────────────┼────────────┼──────────────┨
┃ iter()     │     !      │     !      │     ✓      │      ✓       ┃
┃ contains() │     ✓      │     ✓      │     ✓      │      ✓       ┃
┃ len()      │            │     !      │     !      │      !       ┃
┃ getitem()  │            │            │     !      │      !       ┃
┃ reversed() │            │            │     ✓      │      ✓       ┃
┃ index()    │            │            │            │      ✓       ┃
┃ count()    │            │            │            │      ✓       ┃
┗━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━┛
  • Method iter() is required for 'isinstance(<obj>, abc.Iterable)' to return True, however any object with getitem() method works with any code expecting an iterable.
  • MutableSequence, Set, MutableSet, Mapping and MutableMapping ABCs are also ex­tendable. Use '<abc>.__abstractmethods__' to get names of required methods.

#Enum

Class of named constants called members.

from enum import Enum, auto
class <enum_name>(Enum):
    <member_name> = auto()              # An increment of last numeric value or 1.
    <member_name> = <value>             # Values don't have to be hashable/unique.
    <member_name> = <el_1>, <el_2>      # Value can be a collection, e.g. a tuple.
  • Methods receive the member they were called on as the 'self' argument.
  • Accessing a member named after a reserved keyword causes SyntaxError.
<member> = <enum>.<member_name>         # Accesses a member via enum's attribute.
<member> = <enum>['<member_name>']      # Returns the member or raises KeyError.
<member> = <enum>(<value>)              # Returns the member or raises ValueError.
<str>    = <member>.name                # Returns the member's name as a string.
<obj>    = <member>.value               # Value can't be a user-defined function.
<list>   = list(<enum>)                 # Returns a list containing every member.
<list>   = <enum>._member_names_        # Returns a list containing member names.
<list>   = [m.value for m in <enum>]    # Returns a list containing member values.
<enum>   = type(<member>)               # Returns an enum. Also <memb>.__class__.
<iter>   = itertools.cycle(<enum>)      # Returns an endless iterator of members.
<member> = random.choice(list(<enum>))  # Randomly selects one of enum's members.

Inline

Cutlery = Enum('Cutlery', 'FORK KNIFE SPOON')
Cutlery = Enum('Cutlery', ['FORK', 'KNIFE', 'SPOON'])
Cutlery = Enum('Cutlery', {'FORK': 1, 'KNIFE': 2, 'SPOON': 3})

User-defined functions cannot be values, so they must be wrapped:

from functools import partial
LogicOp = Enum('LogicOp', {'AND': partial(lambda l, r: l and r),
                           'OR':  partial(lambda l, r: l or r)})

#Exceptions

try:
    <code>
except <exception>:
    <code>

Complex Example

try:
    <code_1>
except <exception_a>:
    <code_2_a>
except <exception_b>:
    <code_2_b>
else:
    <code_2_c>
finally:
    <code_3>
  • Code inside the 'else' block will only be executed if 'try' block had no exceptions.
  • Code inside the 'finally' block will always be executed (unless a signal is received).
  • All variables that are initialized in executed blocks are also visible in all subsequent blocks, as well as outside the try statement (only the function block delimits scope).
  • To catch signals use 'signal.signal(signal_number, my_handler_function)'.

Catching Exceptions

except <exception>: ...
except <exception> as <name>: ...
except (<exception>, [...]): ...
except (<exception>, [...]) as <name>: ...
  • It also catches subclasses, e.g. 'ArithmeticError' is caught by 'except Exception:'.
  • Use 'traceback.print_exc()' to print the full error message to standard error stream.
  • Use 'print(<name>)' to print just the cause of the exception (its arguments) to stdout.
  • Use 'logging.exception(<str>)' to log the passed message, followed by the full error message of the caught exception. For details about how to set up the logger see Logging.
  • 'sys.exc_info()' returns type, object and traceback of the caught exception as a tuple.

Raising Exceptions

raise <exception>
raise <exception>()
raise <exception>(<obj> [, ...])

Re-raising caught exception:

except <exception> [as <name>]:
    ...
    raise

Exception Object

arguments = <name>.args
exc_type  = <name>.__class__
filename  = <name>.__traceback__.tb_frame.f_code.co_filename
func_name = <name>.__traceback__.tb_frame.f_code.co_name
line_str  = linecache.getline(filename, <name>.__traceback__.tb_lineno)
trace_str = ''.join(traceback.format_tb(<name>.__traceback__))
error_msg = ''.join(traceback.format_exception(*sys.exc_info()))

Built-in Exceptions

BaseException
 ├── SystemExit                   # Raised when `sys.exit()` is called. See #Exit for details.
 ├── KeyboardInterrupt            # Raised when the user hits the interrupt key, i.e. `ctrl-c`.
 └── Exception                    # User-defined exceptions should be derived from this class.
      ├── ArithmeticError         # Base class for arithmetic errors such as ZeroDivisionError.
      ├── AssertionError          # Raised by `assert <exp>` if expression returns false value.
      ├── AttributeError          # Raised when object doesn't have requested attribute/method.
      ├── EOFError                # Raised by `input()` when it hits an end-of-file condition.
      ├── LookupError             # Base class for errors when a collection can't find an item.
      │    ├── IndexError         # Raised when index of a sequence (list/str) is out of range.
      │    └── KeyError           # Raised when a dictionary's key or a set element is missing.
      ├── MemoryError             # Out of memory. May be too late to start deleting variables.
      ├── NameError               # Raised when nonexistent name (variable/func/class) is used.
      │    └── UnboundLocalError  # Raised when a local name is used before it's being defined.
      ├── OSError                 # Errors such as FileExistsError and TimeoutError. See #Open.
      │    └── ConnectionError    # Errors such as BrokenPipeError and ConnectionAbortedError.
      ├── RuntimeError            # Is raised by errors that do not fit into other categories.
      │    ├── NotImplementedEr…  # Can be raised by abstract methods or by an unfinished code.
      │    └── RecursionError     # Raised if max recursion depth is exceeded (3k by default).
      ├── StopIteration           # Raised when exhausted (empty) iterator is passed to next().
      ├── TypeError               # Raised when argument of wrong type is passed to a function.
      └── ValueError              # Raised when it has the right type but inappropriate value.

Collections and their exceptions:

┏━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━┓
┃           │    List    │    Set     │    Dict    ┃
┠───────────┼────────────┼────────────┼────────────┨
┃ getitem() │ IndexError │            │  KeyError  ┃
┃ pop()     │ IndexError │  KeyError  │  KeyError  ┃
┃ remove()  │ ValueError │  KeyError  │            ┃
┃ index()   │ ValueError │            │            ┃
┗━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┛

Useful built-in exceptions:

raise TypeError('Function received argument of the wrong type!')
raise ValueError('Argument has the right type but its value is off!')
raise RuntimeError('I am too lazy to define my own exception!')

User-defined Exceptions

class MyError(Exception): pass
class MyInputError(MyError): pass

#Exit

Exits the interpreter by raising SystemExit exception.

import sys
sys.exit()                     # Exits with exit code 0 (success).
sys.exit(<int>)                # Exits with the passed exit code.
sys.exit(<obj>)                # Prints to stderr and exits with 1.

#Print

print(<el_1>, ..., sep=' ', end='\n', file=sys.stdout, flush=False)
  • Use 'file=sys.stderr' or 'sys.stderr.write(<str>)' for messages about errors.
  • Stdout and stderr streams hold output in a buffer until they receive a string containing '\n' or '\r', buffer reaches 4096 characters, 'flush=True' is used, or the program exits.

Pretty Print

from pprint import pprint
pprint(<collection>, width=80, depth=None, compact=False, sort_dicts=True)
  • Each item is printed on its own line if collection exceeds 'width' characters.
  • Nested collections that are 'depth=<int>' levels deep get printed as '...'.

#Input

<str> = input()
  • Reads a line from the user input or pipe if present (trailing newline gets stripped).
  • If argument is passed, it gets printed to the standard output before input is read.
  • EOFError is raised if user hits EOF (ctrl-d/ctrl-z⏎) or stream is already exhausted.

#Command Line Arguments

import sys
scripts_path = sys.argv[0]
arguments    = sys.argv[1:]

Argument Parser

from argparse import ArgumentParser
p = ArgumentParser(description=<str>)                       # Also accepts 'usage' str.
p.add_argument('-<char>', '--<name>', action='store_true')  # Flag (defaults to False).
p.add_argument('-<char>', '--<name>', type=<type>)          # Option (defaults to None).
p.add_argument('<name>', type=<type>, nargs=1)              # Mandatory first argument.
p.add_argument('<name>', type=<type>, nargs='+')            # Mandatory remaining args.
p.add_argument('<name>', type=<type>, nargs='?')            # Optional argument. Also *.
args  = p.parse_args()                                      # Exits on a parsing error.
<obj> = args.<name>                                         # Returns `<type>(<arg>)`.
  • Use 'help=<str>' to set argument description that is used by '-h'.
  • Use 'default=<obj>' to set option's or argument's default value.

#Open

Opens a file and returns the corresponding file object.

<file> = open(<path>, mode='r', encoding=None, newline=None)
  • 'encoding=None' means that a default encoding is used, which is platform dependent. Best practice is to use 'encoding="utf-8"' until it becomes the default (Python 3.15).
  • 'newline=None' means that all different end of line combinations are converted to '\n' on read, while on write all '\n' characters are converted to the system's default separator.
  • 'newline=""' means no conversions take place, but input is still broken into chunks by readline() on every '\n', '\r' and '\r\n'. Passing 'newline="\n"' breaks input only on '\n'.
  • 'newline="\r\n"' breaks input only on '\r\n' and converts every '\n' to '\r\n' on write.

Modes

  • 'r' - Reads text from the file (the default option).
  • 'w' - Writes to the file. Deletes existing contents.
  • 'x' - Writes or raises FileExistsError if file exists.
  • 'a' - Appends. Creates new file if it doesn't exist.
  • 'w+' - Reads and writes. Deletes existing contents.
  • 'r+' - Reads and writes from the start of the file.
  • 'a+' - Reads and writes from the end of the file.
  • 'rb' - Reads bytes objects. Also 'wb', 'xb', etc.

Exceptions

  • 'FileNotFoundError' can be raised when reading with 'r' or 'r+'.
  • 'FileExistsError' exception can be raised when writing with 'x'.
  • 'IsADirectoryError', 'PermissionError' can be raised by any.
  • 'except OSError [as <name>]: …' catches all listed exceptions.

File Object

<file>.seek(0)                      # Moves current position to the file's start.
<file>.seek(offset)                 # Moves 'offset' chars/bytes from the start.
<file>.seek(0, 2)                   # Moves current position to the end of file.
<bin_file>.seek(±offset, origin)    # Origin: 0 start, 1 current position, 2 end.
<str/bytes> = <file>.read(size=-1)  # Reads 'size' chars/bytes or until the EOF.
<str/bytes> = <file>.readline()     # Returns a line or empty string/bytes on EOF.
<list>      = <file>.readlines()    # Returns remaining lines. Also list(<file>).
<str/bytes> = next(<file>)          # Returns a line using the read-ahead buffer.
<file>.write(<str/bytes>)           # Writes str or bytes object to write buffer.
<file>.writelines(<collection>)     # Writes a coll. of strings or bytes objects.
<file>.flush()                      # Flushes write buff. Runs every 4096/8192 B.
<file>.close()                      # Closes a file after flushing write buffer.
  • Methods do not add or strip trailing newlines, not even writelines().

Read Text from File

def read_file(filename):
    with open(filename, encoding='utf-8') as file:
        return file.readlines()

Write Text to File

def write_to_file(filename, text):
    with open(filename, 'w', encoding='utf-8') as file:
        file.write(text)

#Paths

import os, glob
from pathlib import Path
<str>  = os.getcwd()                # Returns working dir. Starts as shell's `$PWD`.
<str>  = os.path.join(<path>, ...)  # Uses `os.sep` to join strings or Path objects.
<str>  = os.path.realpath(<path>)   # Resolves symlinks and calls os.path.abspath().
<str>  = os.path.basename(<path>)   # Returns final component (filename or dirname).
<str>  = os.path.dirname(<path>)    # Returns the path without its final component.
<tup.> = os.path.splitext(<path>)   # Splits on last period of the final component.
<list> = os.listdir(path='.')       # Returns all file/dir names located at 'path'.
<list> = glob.glob('<pattern>')     # Returns paths matching the wildcard pattern.
<bool> = os.path.exists(<path>)     # Checks if path exists. Also <Path>.exists().
<bool> = os.path.isfile(<path>)     # Also <Path>.is_file(), <DirEntry>.is_file().
<bool> = os.path.isdir(<path>)      # Also <Path>.is_dir() and <DirEntry>.is_dir().
<stat> = os.stat(<path>)            # A status object. Also <Path/DirEntry>.stat().
<num>  = <stat>.st_size/st_mtime/…  # Returns size in bytes, modification time, ...

DirEntry

Unlike listdir(), scandir() returns DirEntry objects that cache isfile, isdir, and on Windows also stat information, thus significantly increasing the performance of code that requires it.

<iter> = os.scandir(path='.')       # Returns DirEntry objects located at the path.
<str>  = <DirEntry>.path            # Is absolute if 'path' argument was absolute.
<str>  = <DirEntry>.name            # Returns the path's final component as string.
<file> = open(<DirEntry>)           # Opens the file and returns its file object.

Path Object

<Path> = Path(<path> [, ...])       # Accepts strings, Paths, and DirEntry objects.
<Path> = <path> / <path> [/ ...]    # First or second object must be a Path object.
<Path> = <Path>.resolve()           # Returns absolute path with resolved symlinks.
<Path> = Path()                     # Returns current working dir. Also Path('.').
<Path> = Path.cwd()                 # Returns absolute CWD. Also Path().resolve().
<Path> = Path.home()                # Returns the user's absolute home directory.
<Path> = Path(__file__).resolve()   # Returns module's path if CWD wasn't changed.
<Path> = <Path>.parent              # Returns the path without its final component.
<str>  = <Path>.name                # Returns final component (i.e. file/dirname).
<str>  = <Path>.suffix              # Returns the name's last extension with a dot.
<str>  = <Path>.stem                # Returns the name without its last extension.
<tup.> = <Path>.parts               # Starts with '/' or 'C:\' if path is absolute.
<iter> = <Path>.iterdir()           # Returns directory contents as Path objects.
<iter> = <Path>.glob('<pattern>')   # Returns Paths matching the wildcard pattern.
<str>  = str(<Path>)                # Returns path as string. Also <Path>.as_uri().
<file> = open(<Path>)               # Also <Path>.read_text/write_bytes/…(<args>).

#OS Commands

import os, shutil
os.chdir(<path>)                 # Changes the current working directory (or CWD).
os.mkdir(<path>, mode=0o777)     # Creates a directory. Permissions are in octal.
os.makedirs(<path>, mode=0o777)  # Creates all path's dirs. Also `exist_ok=False`.
shutil.copy(from, to)            # Copies the file ('to' can exist or be a dir).
shutil.copy2(from, to)           # Also copies the creation and modification time.
shutil.copytree(from, to)        # Copies the directory ('to' should not exist).
os.rename(from, to)              # Renames or moves the file or directory 'from'.
os.replace(from, to)             # Same, but overwrites file 'to' even on Windows.
shutil.move(from, to)            # `rename()` that moves into 'to' if it's a dir.
os.remove(<path>)                # Deletes file. Also `$ pip3 install send2trash`.
os.rmdir(<path>)                 # Deletes empty dir. Raises OSError if it's not.
shutil.rmtree(<path>)            # Deletes the directory and all of its contents.
  • Passed paths can be either strings, Path objects, or DirEntry objects.
  • Functions report errors by raising OSError or one of its subclasses.

#Shell Commands

import os, subprocess, shlex
<int>  = os.system('<commands>')      # Runs commands in sh/cmd shell. Prints results.
<proc> = subprocess.run('<command>')  # For arguments see examples. Prints by default.
<pipe> = os.popen('<commands>')       # Prints only stderr. Soft deprecated since 3.14.
<str>  = <pipe>.read(size=-1)         # Returns combined stdout. Provides readline/s().
<int>  = <pipe>.close()               # Returns None if last command had returncode 0.

Sends "1 + 1" to the basic calculator and captures its stdout and stderr streams:

>>> subprocess.run('bc', input='1 + 1\n', capture_output=True, text=True)
CompletedProcess(args='bc', returncode=0, stdout='2\n', stderr='')

Sends test.in to the 'bc' running in standard mode and saves its stdout to test.out:

>>> if os.system('echo 1 + 1 > test.in') == 0:
...     with open('test.in') as file_in, open('test.out', 'w') as file_out:
...         subprocess.run(shlex.split('bc -s'), stdin=file_in, stdout=file_out)
...     print(open('test.out').read())
2

#JSON

import json
<str>  = json.dumps(<list/dict>)  # Converts collection to JSON string.
<coll> = json.loads(<str>)        # Converts JSON string to collection.

Read Collection from JSON File

def read_json_file(filename):
    with open(filename, encoding='utf-8') as file:
        return json.load(file)

Write Collection to JSON File

def write_to_json_file(filename, collection):
    with open(filename, 'w', encoding='utf-8') as file:
        json.dump(collection, file, ensure_ascii=False, indent=2)

#Pickle

import pickle
<bytes>  = pickle.dumps(<object>)  # Converts object to bytes object.
<object> = pickle.loads(<bytes>)   # Converts bytes object to object.

Read Object from Pickle File

def read_pickle_file(filename):
    with open(filename, 'rb') as file:
        return pickle.load(file)

Write Object to Pickle File

def write_to_pickle_file(filename, an_object):
    with open(filename, 'wb') as file:
        pickle.dump(an_object, file)

#CSV

Text file format for storing spreadsheets.

import csv
<file>   = open(<path>, newline='')               # Opens the text file for reading.
<reader> = csv.reader(<file>, dialect='excel')    # Also `delimiter=','`. See Params.
<list>   = next(<reader>)                         # Returns a row as list of strings.
<list>   = list(<reader>)                         # Returns a list of remaining rows.
  • Without the 'newline=""' argument, every '\r\n' sequence that is embedded inside a quoted field will get converted to '\n'. For details about the newline argument see Open.
  • To nicely print the spreadsheet to the console use either Tabulate or PrettyTable library.
  • For XML and binary Excel files (with extensions xlsx, xlsm and xlsb) use Pandas library.
  • Reader can consume any iterator or collection of strings, not just text files.

Write

<file>   = open(<path>, mode='a', newline='')     # Opens the text file for writing.
<writer> = csv.writer(<file>, dialect='excel')    # Also `delimiter=','`. See Params.
<writer>.writerow(<collection>)                   # Encodes objects using str(<obj>).
<writer>.writerows(<coll_of_coll>)                # Appends rows to the opened file.
  • If file is opened without the 'newline=""' argument, '\r' will be added in front of every '\n' on platforms that use '\r\n' line endings. I.e., newlines may get doubled on Windows.
  • Open existing file with 'mode="a"' to append to it or 'mode="w"' to overwrite it.

Parameters

  • 'dialect' - Master parameter that sets the default values. String or a csv.Dialect object.
  • 'delimiter' - A one-character string that separates fields. Comma, tab, semicolon, etc.
  • 'lineterminator' - Sets how writer terminates rows. Reader looks for '\n', '\r' and '\r\n'.
  • 'quotechar' - Character for quoting fields containing delimiters, quotechars, '\n' or '\r'.
  • 'escapechar' - Character for escaping quotechars. Can be None if doublequote is True.
  • 'doublequote' - Whether quotechars inside fields are/get doubled (instead of escaped).
  • 'quoting' - 0: As necessary, 1: All, 2: All but numbers which are read as floats, 3: None.
  • 'skipinitialspace' - Is space character at the start of the field stripped by the reader.

Dialects

┏━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━┓
┃                  │     excel    │   excel-tab  │     unix     ┃
┠──────────────────┼──────────────┼──────────────┼──────────────┨
┃ delimiter        │       ','    │      '\t'    │       ','    ┃
┃ lineterminator   │    '\r\n'    │    '\r\n'    │      '\n'    ┃
┃ quotechar        │       '"'    │       '"'    │       '"'    ┃
┃ escapechar       │      None    │      None    │      None    ┃
┃ doublequote      │      True    │      True    │      True    ┃
┃ quoting          │         0    │         0    │         1    ┃
┃ skipinitialspace │     False    │     False    │     False    ┃
┗━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━┛

Read Rows from CSV File

def read_csv_file(filename, **csv_params):
    with open(filename, encoding='utf-8', newline='') as file:
        return list(csv.reader(file, **csv_params))

Write Rows to CSV File

def write_to_csv_file(filename, rows, mode='w', **csv_params):
    with open(filename, mode, encoding='utf-8', newline='') as file:
        writer = csv.writer(file, **csv_params)
        writer.writerows(rows)

#SQLite

A server-less database engine that stores each database into its own file.

import sqlite3
<con> = sqlite3.connect(<path>)             # Opens existing or new file. Also ':memory:'.
<con>.close()                               # Closes connection. Discards uncommitted data.

Read

<cursor> = <con>.execute('SELECT …')        # Can raise a subclass of the `sqlite3.Error`.
<tuple>  = <cursor>.fetchone()              # Returns the next row. Also next(<cursor>).
<list>   = <cursor>.fetchall()              # Returns remaining rows. Also list(<cursor>).

Write

<con>.execute('INSERT …')                   # Can raise a subclass of the `sqlite3.Error`.
<con>.commit()                              # Saves all the changes since the last commit.
<con>.rollback()                            # Discards all changes since the last commit.

Or:

with <con>:                                 # Exits the block with commit() or rollback(),
    <con>.execute('INSERT …')               # depending on whether any exception occurred.

Placeholders

<con>.execute('<sql>', <list/tuple>)        # Replaces every question mark with its item.
<con>.execute('<sql>', <dict/namedtuple>)   # Replaces every :<key> with a matching value.
<con>.executemany('<sql>', <coll_of_coll>)  # Executes statement once for each collection.
  • Accepts strings, ints, floats, bytes, None objects, and bools (stored as 1 or 0).
  • Columns are not restricted to any type unless table is declared as strict.

Example

Values are not actually saved in this example because 'con.commit()' is omitted!

>>> con = sqlite3.connect('test.db')
>>> con.execute('CREATE TABLE person (name TEXT, height INTEGER) STRICT')
>>> con.execute('INSERT INTO person VALUES (?, ?)', ('Jean-Luc', 187))
>>> con.execute('SELECT rowid, * FROM person').fetchall()
[(1, 'Jean-Luc', 187)]

SQLAlchemy

Library for interacting with various DB systems via SQL, method chaining or ORM.

# $ pip3 install sqlalchemy
from sqlalchemy import create_engine, text
<engine> = create_engine('<url>')           # Url: 'dialect://user:password@host/dbname'.
<con>    = <engine>.connect()               # Creates new connection. Also <con>.close().
<cursor> = <con>.execute(text('<sql>'))     # Pass a dict to replace :<key> placeholders.
with <con>.begin(): ...                     # Exits the block with a commit or rollback.
┏━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Dialect         │ pip3 install │           Dependencies           ┃
┠─────────────────┼──────────────┼──────────────────────────────────┨
┃ mysql           │ mysqlclient  │ www.pypi.org/project/mysqlclient ┃
┃ postgresql      │ psycopg2     │ www.pypi.org/project/psycopg2    ┃
┃ mssql           │ pyodbc       │ www.pypi.org/project/pyodbc      ┃
┃ oracle+oracledb │ oracledb     │ www.pypi.org/project/oracledb    ┃
┗━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

#Bytes

An immutable sequence of single bytes. Mutable version is called bytearray.

<bytes> = b'<str>'                       # Accepts ASCII characters and \x00 to \xff.
<int>   = <bytes>[index]                 # Returns the byte as int between 0 and 255.
<bytes> = <bytes>[<slice>]               # Returns bytes even if it has one element.
<bytes> = <bytes>.join(<coll_of_bytes>)  # Joins elements using bytes as a separator.

Encode

<bytes> = bytes(<coll_of_ints>)          # Passed integers must be between 0 and 255.
<bytes> = bytes(<str>, 'utf-8')          # Encodes the string. Same as <str>.encode().
<bytes> = bytes.fromhex('<hex>')         # Hex pairs can be separated by whitespaces.
<bytes> = <int>.to_bytes(n_bytes)        # Accepts `byteorder='little', signed=True`.

Decode

<list>  = list(<bytes>)                  # Returns a list of ints between 0 and 255.
<str>   = str(<bytes>, 'utf-8')          # Returns a string. Same as <bytes>.decode().
<str>   = <bytes>.hex()                  # Returns hex pairs separated by `sep=<str>`.
<int>   = int.from_bytes(<bytes>)        # Accepts `byteorder='little', signed=True`.

Read Bytes from File

def read_bytes(filename):
    with open(filename, 'rb') as file:
        return file.read()

Write Bytes to File

def write_bytes(filename, bytes_obj):
    with open(filename, 'wb') as file:
        file.write(bytes_obj)

#Struct

  • Module that performs conversions between a sequence of numbers and a bytes object.
  • System’s type sizes, byte order, and alignment rules are used by default.
from struct import pack, unpack

<bytes> = pack('<format>', <num_1>, ...)  # Packs numbers according to format.
<tuple> = unpack('<format>', <bytes>)     # Use `iter_unpack()` to get tuples.
>>> pack('>hhl', 1, 2, 3)
b'\x00\x01\x00\x02\x00\x00\x00\x03'
>>> unpack('bhh', b'\x01\x00\x02\x00\x03\x00')
(1, 2, 3)

Format

For standard type sizes and manual alignment (padding) start format string with:

  • '=' - System's byte order (usually little-endian).
  • '<' - Little-endian (i.e. least significant byte first).
  • '>' - Big-endian (also '!').

Besides numbers, pack() and unpack() also support bytes objects as a part of the sequence:

  • 'c' - A bytes object with a single element. For pad byte use 'x'.
  • '<n>s' - A bytes object with n elements (not effected by byte order).

Integers. Use capital letter for unsigned type. Minimum/standard sizes are in brackets:

  • 'b' - char (1/1)
  • 'h' - short (2/2)
  • 'i' - int (2/4)
  • 'l' - long (4/4)
  • 'q' - long long (8/8)

Floating point types (struct always uses standard sizes):

  • 'f' - float (4/4)
  • 'd' - double (8/8)

#Array

List that can only hold numbers that fit into the passed C type. Available types and their min­imum sizes in bytes are listed above. Type sizes and byte order are always determined by the system, how­ever bytes of each element can be reversed (by calling the byteswap() method).

from array import array
<array> = array('<typecode>' [, <coll>])  # Creates array. Accepts collection of numbers.
<array> = array('<typecode>', <bytes>)    # Copies passed bytes into the array's memory.
<array> = array('<typecode>', <array>)    # Treats passed array as a sequence of numbers.
<array>.fromfile(<file>, n_items)         # Appends file contents to the array's memory.
<bytes> = bytes(<array>)                  # Returns copy of the memory as a bytes object.
<file>.write(<array>)                     # Appends the array's memory to a binary file.

#Memory View

A sequence object that points to the memory of another bytes-like object. Each element can reference a single or multiple consecutive bytes, depending on format. Order and number of elements can be changed with slicing.

<mview> = memoryview(<bytes/array>)       # Returns mutable memoryview if array is passed.
<obj>   = <mview>[index]                  # Returns an int/float. Bytes if format is 'c'.
<mview> = <mview>[<slice>]                # Returns a memoryview with rearranged elements.
<mview> = <mview>.cast('<typecode>')      # Only works between B/b/c and the other types.
<mview>.release()                         # Releases the memory buffer of the base object.
<bytes> = bytes(<mview>)                  # Returns a new bytes object. Also bytearray().
<bytes> = <bytes>.join(<coll_of_mviews>)  # Joins memoryviews using bytes as a separator.
<array> = array('<typecode>', <mview>)    # Treats passed mview as a sequence of numbers.
<file>.write(<mview>)                     # Appends `bytes(<mview>)` to the binary file.
<list>  = list(<mview>)                   # Returns list of ints, floats or bytes objects.
<str>   = str(<mview>, 'utf-8')           # Treats passed memoryview as `bytes(<mview>)`.
<str>   = <mview>.hex()                   # Returns hex pairs separated with `sep=<str>`.

#Deque

List with efficient appends and pops from either side.

from collections import deque
<deque> = deque(<collection>)     # Pass `maxlen=<int>` to set the size limit.
<deque>.appendleft(<el>)          # Drops last element if maxlen is exceeded.
<deque>.extendleft(<collection>)  # Prepends reversed collection to the deque.
<deque>.rotate(n=1)               # Moves last element to the start of deque.
<el> = <deque>.popleft()          # Removes and returns deque's first element.

#Operator

Module of functions that provide the functionality of operators. Functions are grouped by operator precedence, from least to most binding. Functions and operators in first, third and fifth line are also ordered by precedence within a line.

import operator as op
<bool> = op.not_(<obj>)                                      # or, and, not (or/and missing).
<bool> = op.eq/ne/lt/ge/is_/is_not/contains(<obj>, <obj>)    # ==, !=, <, >=, is, is not, in.
<obj>  = op.or_/xor/and_(<int/set>, <int/set>)               # |, ^, & (sorted by precedence).
<int>  = op.lshift/rshift(<int>, <int>)                      # <<, >> (i.e. <int> << n_bits).
<obj>  = op.add/sub/mul/truediv/floordiv/mod(<obj>, <obj>)   # +, -, *, /, //, % (two groups).
<num>  = op.neg/invert(<num>)                                # -, ~ (negate and bitwise not).
<num>  = op.pow(<num>, <num>)                                # ** (pow() accepts 3 arguments).
<func> = op.itemgetter/attrgetter/methodcaller(<obj> [, …])  # [index/key], .name, .name([…]).
elementwise_sum  = map(op.add, list_a, list_b)
sorted_by_second = sorted(<coll>, key=op.itemgetter(1))
sorted_by_both   = sorted(<coll>, key=op.itemgetter(1, 0))
first_element    = op.methodcaller('pop', 0)(<list>)
  • Most operators call the object's special method that is named after them (second object is passed as an argument), while logical operators call their own code that relies on bool().
  • 'and/or' can't be emulated by a function because they might not evaluate all operands.
  • Comparisons can be chained: 'x < y < z' gets converted to '(x < y) and (y < z)'.

#Match Statement

Executes the first block with matching pattern.

match <object/expression>:
    case <pattern> [if <condition>]:
        <code>
    ...

Patterns

<value_pattern> = 1/'abc'/True/None/math.pi        # Matches the literal or attribute's value.
<class_pattern> = <type>()                         # Matches any object of that type (or ABC).
<wildcard_patt> = _                                # Matches any object. Useful in last case.
<capture_patt>  = <name>                           # Matches any object and binds it to name.
<as_pattern>    = <pattern> as <name>              # Binds match to name. Also <type>(<name>).
<or_pattern>    = <pattern> | <pattern> [| ...]    # Matches if any of listed patterns match.
<sequence_patt> = [<pattern>, ...]                 # Matches a sequence. All items must match.
<mapping_patt>  = {<value_pattern>: <patt>, ...}   # Matches a dict if it has matching items.
<class_pattern> = <type>(<attr_name>=<patt>, ...)  # Matches object with matching attributes.
  • The sequence pattern can also be written as a tuple, either with or without the brackets.
  • Use '*<name>' and '**<name>' in sequence/mapping patterns to bind remaining items.
  • Patterns can be surrounded with brackets to override their precedence: '|' > 'as' > ','. For example, '[1, 2]' is matched by expression 'case 1|2, 2|3 as y if y == 2:'.
  • All names that are bound in the matching case, as well as variables initialized in its body, are visible after the match statement (only function block delimits scope).

Example

>>> from pathlib import Path
>>> match Path('/home/ken/python-cheatsheet/README.md'):
...     case Path(
...         parts=['/', 'home', user, *_]
...     ) as p if p.name.lower().startswith('readme') and p.is_file():
...         print(f'{p.name} is a readme file that belongs to user {user}.')
README.md is a readme file that belongs to user ken.

#Logging

import logging as log
log.basicConfig(filename=<path>, level='WARNING')  # Configures the root logger (see Setup).
log.debug/info/warning/error/critical(<str>)       # Sends passed message to the root logger.
<Logger> = log.getLogger(__name__)                 # Returns a logger named after the module.
<Logger>.<level>(<str>)                            # Sends the message. Same levels as above.
<Logger>.exception(<str>)                          # `error()` that appends caught exception.

Setup

log.basicConfig(
    filename=None,                                 # Prints to stderr when filename is None.
    filemode='a',                                  # Use mode 'w' to overwrite existing file.
    format='%(levelname)s:%(name)s:%(message)s',   # Using '%(asctime)s' adds local datetime.
    level=log.WARNING,                             # Drops messages that have lower priority.
    handlers=[log.StreamHandler(sys.stderr)]       # Uses FileHandler when 'filename' is set.
)
<Formatter> = log.Formatter('<format>')            # Formats messages using the format str.
<Handler> = log.FileHandler(<path>, mode='a')      # Appends to file. Also `encoding=None`.
<Handler>.setFormatter(<Formatter>)                # Only outputs bare messages by default.
<Handler>.setLevel(<str/int>)                      # Prints/saves every message by default.
<Logger>.addHandler(<Handler>)                     # Loggers can have more than one handler.
<Logger>.setLevel(<str/int>)                       # What's sent to its/ancestors' handlers.
<Logger>.propagate = <bool>                        # Cuts off ancestors' handlers if False.
  • Parent logger can be specified by naming the child logger '<parent_name>.<name>'.
  • Logger will inherit the level from its parent if you don't set it via the setLevel() method.
  • Format string can contain: pathname, filename, funcName, lineno, thread and process.
  • RotatingFileHandler rotates files according to 'maxBytes' and 'backupCount' arguments.
  • An object with 'filter(<LogRecord>)' method (or the method itself) can be added to loggers and handlers via addFilter(). Message is dropped if filter() returns a false value.
  • Logging messages generated by libraries are passed to the root's handlers. Level of the library's logger can be set with 'log.getLogger("<library>").setLevel(<str>)'.

Logger that writes messages to a file and sends them to the root's handler that prints warnings or higher:

>>> logger = log.getLogger('my_module')
>>> handler = log.FileHandler('test.log', encoding='utf-8')
>>> format_str = '%(asctime)s %(levelname)s:%(name)s:%(message)s'
>>> handler.setFormatter(log.Formatter(format_str))
>>> logger.addHandler(handler)
>>> logger.setLevel('DEBUG')
>>> log.basicConfig()
>>> roots_handler = log.root.handlers[0]
>>> roots_handler.setLevel('WARNING')
>>> logger.critical('Missing config file.')
CRITICAL:my_module:Missing config file.
>>> print(open('test.log').read())
2023-02-07 23:21:01,430 CRITICAL:my_module:Missing config file.

#Introspection

<list> = dir()                     # Local names of objects (including functions and classes).
<dict> = vars()                    # Dict of local names and their objects. Same as locals().
<dict> = globals()                 # Dict of global names and their objects, e.g. __builtin__.
<list> = dir(<obj>)                # Returns names of object's attributes (including methods).
<dict> = vars(<obj>)               # Returns dict of writable attributes. Also <obj>.__dict__.
<bool> = hasattr(<obj>, '<name>')  # Checks if object possesses attribute of the passed name.
value  = getattr(<obj>, '<name>')  # Returns the object's attribute or raises AttributeError.
setattr(<obj>, '<name>', value)    # Sets attribute. Only works on objects with __dict__ attr.
delattr(<obj>, '<name>')           # Deletes attribute from __dict__. Also `del <obj>.<name>`.

#Threading

CPython interpreter can only run a single thread at a time. Using multiple threads won't result in a faster execution, unless at least one of the threads contains an I/O operation.

from threading import Thread, Lock, RLock, Semaphore, Event, Barrier
from concurrent.futures import ThreadPoolExecutor, as_completed

Thread

<Thread> = Thread(target=<function>)          # Use `args=<coll>` to set function's arguments.
<Thread>.start()                              # Runs function in background. Also is_alive().
<Thread>.join()                               # Waits until the function finishes executing.
  • Use 'kwargs=<dict>' to pass keyword arguments to the function, i.e. thread.
  • Use 'daemon=True', or the program won't be able to exit while the thread is alive.

Lock

<lock> = Lock/RLock()                         # RLock can only be released by acquirer thread.
<lock>.acquire()                              # Blocks (waits) until lock becomes available.
<lock>.release()                              # Releases the lock so it can be acquired again.

Or:

with <lock>:                                  # Enters the block by calling method acquire().
    ...                                       # Exits it by calling release(), even on error.

Semaphore, Event, Barrier

<Semaphore> = Semaphore(value=1)              # Lock that can be acquired by 'value' threads.
<Event>     = Event()                         # Method wait() blocks until set() is called.
<Barrier>   = Barrier(<int>)                  # `wait()` blocks until it's called int times.

Queue

<Queue> = queue.Queue(maxsize=0)              # A first-in-first-out queue. It's thread safe.
<Queue>.put(<obj>)                            # The call blocks until queue stops being full.
<Queue>.put_nowait(<obj>)                     # Raises queue.Full exception if queue is full.
<obj> = <Queue>.get()                         # The call blocks until queue stops being empty.
<obj> = <Queue>.get_nowait()                  # Raises queue.Empty exception if it is empty.

Thread Pool Executor

<Exec> = ThreadPoolExec…(max_workers=None)    # Also `with ThreadPoolExecutor() as <name>: …`.
<iter> = <Exec>.map(<func>, <args_1>, ...)    # Multithreaded and non-lazy map(). Keeps order.
<Futr> = <Exec>.submit(<func>, <arg_1>, ...)  # Creates a thread and queues it for execution.
<Exec>.shutdown()                             # Waits for all the threads to finish executing.
<bool> = <Future>.done()                      # Checks if the thread has finished executing.
<obj>  = <Future>.result(timeout=None)        # Raises TimeoutError after 'timeout' seconds.
<bool> = <Future>.cancel()                    # Just returns False if it is running/finished.
<iter> = as_completed(<coll_of_Futures>)      # `next(<iter>)` returns next completed Future.
  • Map() and as_completed() also accept 'timeout' arg. It causes futures.TimeoutError when next() is called or blocking. Map() times from original call and as_completed() from first call to next(). As_completed() fails if next() is called too late, even if all threads are done.
  • Exceptions that happen inside threads are raised when map's next() or Future's result() method is called. Future's exception() method returns caught exception object or None.
  • ProcessPoolExecutor provides true parallelism but: everything sent to and from workers must be pickable, queues must be sent using executor's 'initargs' and 'initializer' param­eters, and executor should only be reachable via 'if __name__ == "__main__": …'.

#Asyncio

  • Coroutines have a lot in common with threads, but unlike threads, they only give up control when they call another coroutine and they don’t consume as much memory.
  • Coroutine definition starts with 'async' keyword and its call with 'await' keyword.
  • Execute 'asyncio.run(<coroutine>)' to start running the first/main coroutine.
import asyncio as aio
<coro> = <async_function>(<args>)          # Creates a coroutine by calling async def function.
<obj>  = await <coroutine>                 # Starts the coroutine. Returns its result or None.
<task> = aio.create_task(<coroutine>)      # Schedules it for execution. Always keep the task.
<obj>  = await <task>                      # Returns coroutine's result. Also <task>.cancel().
<coro> = aio.gather(<coro/task>, ...)      # Schedules coros. Returns list of results on await.
<coro> = aio.wait(<tasks>, return_when=…)  # `'ALL/FIRST_COMPLETED'`. Returns (done, pending).
<iter> = aio.as_completed(<coros/tasks>)   # Calling `await next(<iter>)` returns next result.

Runs a terminal game where you control an asterisk that must avoid numbers:

import asyncio, collections, curses, curses.textpad, enum, random

P = collections.namedtuple('P', 'x y')     # Position (x and y coordinates).
D = enum.Enum('D', 'n e s w')              # Direction (north, east, etc.).
W, H = 15, 7                               # Width and height of the field.

def main(screen):
    curses.curs_set(0)                     # Makes the cursor invisible.
    screen.nodelay(True)                   # Makes getch() non-blocking.
    asyncio.run(main_coroutine(screen))    # Starts running asyncio code.

async def main_coroutine(screen):
    moves = asyncio.Queue()
    state = {'*': P(0, 0)} | dict.fromkeys(range(10), P(W//2, H//2))
    ai    = [random_controller(id_, moves) for id_ in range(10)]
    mvc   = [controller(screen, moves), model(moves, state), view(state, screen)]
    tasks = [asyncio.create_task(coro) for coro in ai + mvc]
    await asyncio.wait(tasks, return_when=asyncio.FIRST_COMPLETED)

async def random_controller(id_, moves):
    while True:
        d = random.choice(list(D))
        moves.put_nowait((id_, d))
        await asyncio.sleep(random.triangular(0.01, 0.65))

async def controller(screen, moves):
    while True:
        key_mappings = {258: D.s, 259: D.n, 260: D.w, 261: D.e}
        if d := key_mappings.get(screen.getch()):
            moves.put_nowait(('*', d))
        await asyncio.sleep(0.005)

async def model(moves, state):
    while state['*'] not in (state[id_] for id_ in range(10)):
        id_, d = await moves.get()
        deltas = {D.n: P(0, -1), D.e: P(1, 0), D.s: P(0, 1), D.w: P(-1, 0)}
        state[id_] = P((state[id_].x + deltas[d].x) % W, (state[id_].y + deltas[d].y) % H)

async def view(state, screen):
    offset = P(curses.COLS//2 - W//2, curses.LINES//2 - H//2)
    while True:
        screen.erase()
        curses.textpad.rectangle(screen, offset.y-1, offset.x-1, offset.y+H, offset.x+W)
        for id_, p in state.items():
            screen.addstr(offset.y + (p.y - state['*'].y + H//2) % H,
                          offset.x + (p.x - state['*'].x + W//2) % W, str(id_))
        screen.refresh()
        await asyncio.sleep(0.005)

if __name__ == '__main__':
    curses.wrapper(main)


Libraries

#Progress Bar

# $ pip3 install tqdm
>>> import tqdm, time
>>> for el in tqdm.tqdm([1, 2, 3], desc='Processing'):
...     time.sleep(1)
Processing: 100%|████████████████████| 3/3 [00:03<00:00,  1.00s/it]

#Plot

# $ pip3 install matplotlib
import matplotlib.pyplot as plt

plt.plot/bar/scatter(x_data, y_data, label=None)  # Accepts plt.plot(y_data).
plt.legend()                                      # Adds a legend of labels.
plt.title/xlabel/ylabel(<str>)                    # Adds title or axis label.
plt.show()                                        # Also plt.savefig(<path>).
plt.clf()                                         # Clears the plot (figure).

#Table

Prints a CSV spreadsheet to the console:

# $ pip3 install tabulate
import csv, tabulate
with open('test.csv', encoding='utf-8', newline='') as file:
    rows = list(csv.reader(file))
print(tabulate.tabulate(rows, headers='firstrow'))

#Console App

Runs a basic file explorer in the console:

# $ pip3 install windows-curses
import curses, os
from curses import A_REVERSE, KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT

def main(screen):
    ch, first, selected, paths = 0, 0, 0, os.listdir()
    while ch != ord('q'):
        height, width = screen.getmaxyx()
        screen.erase()
        for y, filename in enumerate(paths[first : first+height]):
            color = A_REVERSE if filename == paths[selected] else 0
            screen.addnstr(y, 0, filename, width-1, color)
        ch = screen.getch()
        selected -= (ch == KEY_UP) and (selected > 0)
        selected += (ch == KEY_DOWN) and (selected < len(paths)-1)
        first -= (first > selected)
        first += (first < selected-(height-1))
        if ch in [KEY_LEFT, KEY_RIGHT, ord('\n')]:
            new_dir = '..' if ch == KEY_LEFT else paths[selected]
            if os.path.isdir(new_dir):
                os.chdir(new_dir)
                first, selected, paths = 0, 0, os.listdir()

if __name__ == '__main__':
    curses.wrapper(main)

#GUI App

Runs a desktop app for converting weights from metric units into pounds:

# $ pip3 install FreeSimpleGUI
import FreeSimpleGUI as sg

text_box = sg.Input(default_text='100', enable_events=True, key='QUANTITY')
dropdown = sg.InputCombo(['g', 'kg', 't'], 'kg', readonly=True, enable_events=True, k='UNIT')
label = sg.Text('100 kg is 220.462 lbs.', key='OUTPUT')
window = sg.Window('GUI App', [[text_box, dropdown], [label], [sg.Button('Close')]])

while True:
    event, values = window.read()
    if event in [sg.WIN_CLOSED, 'Close']:
        break
    try:
        quantity = float(values['QUANTITY'])
    except ValueError:
        continue
    unit = values['UNIT']
    lbs = quantity * {'g': 0.001, 'kg': 1, 't': 1000}[unit] / 0.45359237
    window['OUTPUT'].update(value=f'{quantity} {unit} is {lbs:g} lbs.')
window.close()

#Scraping

Scrapes Python's URL and logo from its Wikipedia page:

# $ pip3 install requests beautifulsoup4
import requests, bs4, os

get = lambda url: requests.get(url, headers={'User-Agent': 'cpc-bot'})
response = get('https://en.wikipedia.org/wiki/Python_(programming_language)')
document = bs4.BeautifulSoup(response.text, 'html.parser')
table = document.find('table', class_='infobox vevent')
python_url = table.find('th', string='Website').next_sibling.a['href']
logo_url = table.find('img')['src']
filename = os.path.basename(logo_url)
with open(filename, 'wb') as file:
    file.write(get(f'https:{logo_url}').content)
print(f'URL: {python_url}, logo: file://{os.path.abspath(filename)}')

Selenium

Library for scraping websites with dynamic content.

# $ pip3 install selenium
from selenium import webdriver
<Drv> = webdriver.Chrome/Firefox/Safari/Edge()  # Opens the browser. Also <Driver>.quit().
<Drv>.implicitly_wait(seconds)                  # Sets timeout for find_element/s() methods.
<Drv>.get('<url>')                              # Blocks until browser fires the load event.
<str> = <Drv>.page_source                       # Returns HTML of the page's current state.
<El>  = <Drv/El>.find_element('xpath', <str>)   # Accepts '//<tag>[@<attr_name>="<val>"]…'.
<str> = <El>.get_attribute('<name>')            # Returns attribute or a property if exists.
<El>.click/clear()                              # Also <El>.text and <El>.send_keys(<str>).

XPath — also available in lxml, Scrapy, and browser's console via '$x("<xpath>")':

<xpath>     = //<element>[/ or // <element>]    # E.g. …/child, …//descendant, …/../sibling.
<xpath>     = //<element>/following::<element>  # Next element. Also preceding::, parent::.
<element>   = <tag><conditions><index>          # Tag accepts */a/…. Use [1/2/…] for index.
<condition> = [<sub_cond> [and/or <sub_cond>]]  # Use `not(<sub_cond>)` to negate condition.
<sub_cond>  = @<attr>[="<val>"]                 # `text()=` and `.=` match (complete) text.
<sub_cond>  = contains(@<attr>, "<val>")        # Is <val> a substring of attribute's value?
<sub_cond>  = [//]<element>                     # Has matching child? Descendant if //<el>.

#Web App

Flask is a micro web framework that also includes a simple WSGI/HTTP server. If you just want to open a HTML file in a web browser use 'webbrowser.open(<path>)' instead.

# $ pip3 install flask
import flask as fl
app = fl.Flask(__name__)                   # Returns application obj. Put at the top.
app.run(host=None, port=None, debug=None)  # Also `$ flask --app FILE run --ARG=VAL`.
  • Starts the app at 'http://localhost:5000'. Use 'host="0.0.0.0"' to run externally.
  • Install a WSGI server like Waitress and a HTTP server such as Nginx to get better security.
  • Debug mode restarts the app whenever script changes and displays errors in the browser.

Serving Files

@app.route('/img/<path:filename>')
def serve_file(filename):
    return fl.send_from_directory('DIRNAME', filename)

Serving HTML

@app.route('/<sport>')
def serve_html(sport):
    return fl.render_template_string('<h1>{{title}}</h1>', title=sport)
  • 'fl.render_template(filename, <kwargs>)' renders a file located in 'templates' dir.
  • 'fl.abort(<int>)' returns error code and 'return fl.redirect(<url>)' redirects.
  • 'fl.request.args[<str>]' returns parameter from query string (URL part right of '?').
  • 'fl.session[<str>] = <obj>' stores session data and 'fl.session.clear()' clears it. A session cookie key needs to be set at the startup with 'app.secret_key = <str>'.

Serving JSON

@app.post('/<sport>/odds')
def serve_json(sport):
    team = fl.request.form['team']
    return {'team': team, 'odds': [2.09, 3.74, 3.68]}

Starts the app in its own thread and queries its REST API:

# $ pip3 install requests
>>> import threading, requests
>>> threading.Thread(target=app.run, daemon=True).start()
>>> url = 'http://localhost:5000/football/odds'
>>> response = requests.post(url, data={'team': 'arsenal f.c.'})
>>> response.json()
{'team': 'arsenal f.c.', 'odds': [2.09, 3.74, 3.68]}

#Profiling

from time import perf_counter
start_time = perf_counter()
...
duration_in_seconds = perf_counter() - start_time

Timing a Snippet

>>> from timeit import timeit
>>> timeit('list(range(10000))', number=1000, globals=globals(), setup='pass')
0.19373

Profiling by Line

$ pip3 install line_profiler
$ echo '@profile
def main():
    a = list(range(10000))
    b = set(range(10000))
main()' > test.py
$ kernprof -lv test.py
Line #      Hits         Time  Per Hit   % Time  Line Contents
==============================================================
     1                                           @profile
     2                                           def main():
     3         1        253.4    253.4     32.2      a = list(range(10000))
     4         1        534.1    534.1     67.8      b = set(range(10000))

Call and Flame Graphs

$ apt install graphviz && pip3 install gprof2dot snakeviz  # Or install graphviz.exe.
$ tail -n +2 test.py > test.tmp && mv test.tmp test.py     # Removes the first line.
$ python3 -m cProfile -o test.prof test.py                 # Runs a tracing profiler.
$ gprof2dot -f pstats test.prof | dot -T png -o test.png   # Generates a call graph.
$ xdg-open test.png                                        # Displays the call graph.
$ snakeviz test.prof                                       # Displays a flame graph.

Sampling and Memory Profilers

┏━━━━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━┯━━━━━━┓
┃ pip3 install │   Target   │          How to run           │ Lines │ Live ┃
┠──────────────┼────────────┼───────────────────────────────┼───────┼──────┨
┃ pyinstrument │    CPU     │ pyinstrument test.py          │   ×   │  ×   ┃
┃ py-spy       │    CPU     │ py-spy top -- python3 test.py │   ×   │  ✓   ┃
┃ scalene      │ CPU+Memory │ scalene test.py               │   ✓   │  ×   ┃
┃ memray       │   Memory   │ memray run --live test.py     │   ✓   │  ✓   ┃
┗━━━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━┷━━━━━━┛

#NumPy

Array manipulation mini-language. It can run up to one hundred times faster than the equivalent Python code. An even faster alternative that runs on a GPU is called CuPy.

# $ pip3 install numpy
import numpy as np
<array> = np.array(<list/list_of_lists/…> [, dtype])  # NumPy array of one or more dimensions.
<array> = np.zeros/ones/empty(shape)                  # Pass a tuple of ints (dimension sizes).
<array> = np.arange(from_inc, to_exc, ±step)          # Also np.linspace(start, stop, length).
<array> = np.random.randint(from_inc, to_exc, shape)  # Also random.uniform(low, high, shape).
<view>  = <array>.reshape(shape)                      # Also `<array>.shape = (<int>, [...])`.
<array> = <array>.flatten()                           # Returns 1d copy. Also <array>.ravel().
<view>  = <array>.transpose()                         # Flips the table over its main diagonal.
<array> = np.copy/abs/sqrt/log/int64(<array>)         # Returns a new array of the same shape.
<array> = <array>.sum/max/mean/argmax/all(axis)       # Aggregates dimension with passed index.
<array> = np.apply_along_axis(<func>, axis, <array>)  # Func. can return a scalar or an array.
<array> = np.concatenate(<list_of_arrays>, axis=0)    # Links arrays along first axis (rows).
<array> = np.vstack/column_stack(<list_of_arrays>)    # A 1d array is treated as a row/column.
<array> = np.tile/repeat(<array>, <int/s> [, axis])   # Tiles the array or repeats elements.
  • Shape is a tuple of dimension sizes. A 100x50 RGB image has shape (50, 100, 3).
  • Axis is an index of a dimension. Leftmost dimension has index 0. Summing the RGB image along axis 2 will return a greyscale image with shape (50, 100).

Indexing

<el>       = <2d>[row_index, col_index]               # Also `<3d>[<int>, <int>, <int>]`.
<1d_view>  = <2d>[row_index]                          # Also `<3d>[<int>, <int>, <slice>]`.
<1d_view>  = <2d>[:, col_index]                       # Also `<3d>[<int>, <slice>, <int>]`.
<2d_view>  = <2d>[from:to_row_i, from:to_col_i]       # Also `<3d>[<int>, <slice>, <slice>]`.
<1d_array> = <2d>[row_indices, col_indices]           # Also `<3d>[<int/1d>, <1d>, <1d>]`.
<2d_array> = <2d>[row_indices]                        # Also `<3d>[<int/1d>, <1d>, <slice>]`.
<2d_array> = <2d>[:, col_indices]                     # Also `<3d>[<int/1d>, <slice>, <1d>]`.
<2d_array> = <2d>[np.ix_(row_indices, col_indices)]   # Also `<3d>[<int/1d/2d>, <2d>, <2d>]`.
<2d_bools> = <2d> > <el/1d/2d>                        # A 1d object must be a size of a row.
<1/2d_arr> = <2d>[<2d/1d_bools>]                      # A 1d object must be a size of a col.
  • ':' returns a slice of all dimension's indices. If dimension is omitted, it defaults to ':'.
  • Passing two slices (line 4) works the same as when a slice and 1d array are passed (line 7).
  • Python converts 'obj[i, j]' to 'obj[(i, j)]'. This makes '<2d>[row_i, col_i]' and '<2d>[row_indices]' indistinguishable to NumPy if tuple of two indices is passed.
  • 'ix_([1, 2], [3, 4])' returns '[[1], [2]]' and '[[3, 4]]'. Due to broadcasting rules, this is the same as indexing via '[[1, 1], [2, 2]]' and '[[3, 4], [3, 4]]'.
  • Any value that is broadcastable to the indexed shape can be assigned to the selection.

Broadcasting

Array reshaping procedure used by arithmetic operations, etc.

array_a = np.array([0.1,  0.6,  0.8])                 # I.e. `array_a.shape == (3,)`.
array_b = np.array([[0.1], [0.6], [0.8]])             # I.e. `array_b.shape == (3, 1)`.

1. If array shapes differ in length, left-pad the shorter shape with ones:

array_a = np.array([[0.1,  0.6,  0.8]])               # I.e. `array_a.shape == (1, 3)`.
array_b = np.array([[0.1], [0.6], [0.8]])             # I.e. `array_b.shape == (3, 1)`.

2. Expand dimensions with size 1 by duplicating their elements/arrays:

array_a = np.array([[0.1,  0.6,  0.8],                # I.e. `array_a.shape == (3, 3)`.
                    [0.1,  0.6,  0.8],
                    [0.1,  0.6,  0.8]])

array_b = np.array([[0.1,  0.1,  0.1],                # I.e. `array_b.shape == (3, 3)`.
                    [0.6,  0.6,  0.6],
                    [0.8,  0.8,  0.8]])

Example

For each point returns index of its nearest point ([0.1, 0.6, 0.8] => [1, 2, 1]):

>>> print(points := np.array([0.1, 0.6, 0.8]))
[0.1  0.6  0.8]
>>> print(wrapped_points := points.reshape(3, 1))
[[0.1]
 [0.6]
 [0.8]]
>>> print(deltas := points - wrapped_points)
[[ 0.   0.5  0.7]
 [-0.5  0.   0.2]
 [-0.7 -0.2  0. ]]
>>> deltas[range(3), range(3)] = np.inf
>>> print(distances := np.abs(deltas))
[[inf  0.5  0.7]
 [0.5  inf  0.2]
 [0.7  0.2  inf]]
>>> print(distances.argmin(axis=1))
[1 2 1]

#Image

# $ pip3 install pillow
from PIL import Image
<Image> = Image.new('RGB', (width, height))   # Creates an image. Also `color=<tuple_of_ints>`.
<Image> = Image.open(<path>)                  # Identifies format based on the file's contents.
<Image> = <Image>.convert('<mode>')           # Converts the image to the new mode (see Modes).
<Image>.save(<path>)                          # Also `quality=<int>` if extension is jpg/jpeg.
<Image>.show()                                # Displays image in system's default preview app.
<int/tup> = <Image>.getpixel((x, y))          # Returns the pixel's value, that is, its color.
<ImgCore> = <Image>.getdata()                 # Returns a flattened view of the pixel values.
<Image>.putpixel((x, y), <int/tuple>)         # Updates pixel's value. Clips passed integer/s.
<Image>.putdata(<list/ImgCore>)               # Updates pixels with a copy of passed sequence.
<Image>.paste(<Image>, (x, y))                # Draws passed image at the specified location.
<Image> = <Image>.filter(<Filter>)            # Accepts ImageFilter.BLUR/SHARPEN/FIND_EDGES/….
<Image> = <Enhance>.enhance(<float>)          # E.g. `ImageEnhance.Contrast/Color/…(<Image>)`.
<array> = np.array(<Image>)                   # Creates a 2d or 3d NumPy array from the image.
<Image> = Image.fromarray(np.uint8(<array>))  # Use `<array>.clip(0, 255)` to clip the values.

Modes

  • 'L' - Lightness (greyscale image). Each pixel is stored as an int between 0 and 255.
  • 'RGB' - Red, green, blue (true color image). Each pixel is a tuple of three integers.
  • 'RGBA' - RGB with alpha. Low alpha (i.e. fourth int) makes pixel more transparent.
  • 'HSV' - Hue, saturation, value. Three ints representing color in HSV color space.

Examples

Creates a PNG image of a rainbow gradient:

WIDTH, HEIGHT = 100, 100
n_pixels = WIDTH * HEIGHT
hues = (255 * i/n_pixels for i in range(n_pixels))
img = Image.new('HSV', (WIDTH, HEIGHT))
img.putdata([(int(h), 255, 255) for h in hues])
img.convert('RGB').save('test.png')

Adds noise to the PNG image and displays it:

from random import randint
add_noise = lambda value: max(0, min(255, value + randint(-20, 20)))
img = Image.open('test.png').convert('HSV')
img.putdata([(add_noise(h), s, v) for h, s, v in img.getdata()])
img.show()

Image Draw

from PIL import ImageDraw
<Draw> = ImageDraw.Draw(<Image>)              # An object for adding 2D graphics to the image.
<Draw>.point((x, y))                          # Draws a point. Accepts `fill=<int/tuple/str>`.
<Draw>.line((x1, y1, x2, y2 [, ...]))         # To get anti-aliasing use <Img>.resize((w, h)).
<Draw>.arc((x1, y1, x2, y2), deg1, deg2)      # Draws arc of an ellipse in clockwise direction.
<Draw>.rectangle((x1, y1, x2, y2))            # Also rounded_rectangle() and regular_polygon().
<Draw>.polygon((x1, y1, x2, y2, ...))         # The last point gets connected to the first one.
<Draw>.ellipse((x1, y1, x2, y2))              # To rotate it use <Image>.rotate(anticlock_deg).
<Draw>.text((x, y), <str>)                    # Accepts `font=ImageFont.truetype(path, size)`.
  • Pass 'fill=<color>' to set primary color of the figure.
  • Pass 'width=<int>' to set the width of lines or contours.
  • Pass 'outline=<color>' to set the color of the contours.
  • Color can be an int, tuple, '#rrggbb[aa]' or color name.

#Animation

Creates a GIF of a bouncing ball:

# $ pip3 install imageio
from PIL import Image, ImageDraw
import imageio

WIDTH, HEIGHT, R = 126, 126, 10
frames = []
for velocity in range(1, 16):
    y = sum(range(velocity))
    frame = Image.new('L', (WIDTH, HEIGHT))
    draw = ImageDraw.Draw(frame)
    draw.ellipse((WIDTH/2-R, y, WIDTH/2+R, y+R*2), fill='white')
    frames.append(frame)
frames += reversed(frames[1:-1])
imageio.mimsave('test.gif', frames, duration=0.03)

#Audio

import wave
<Wave>  = wave.open('<path>')               # Opens specified WAV file for reading.
<int>   = <Wave>.getframerate()             # Returns number of frames per second.
<int>   = <Wave>.getnchannels()             # Returns number of samples per frame.
<int>   = <Wave>.getsampwidth()             # Returns number of bytes per sample.
<tuple> = <Wave>.getparams()                # Returns namedtuple of all parameters.
<bytes> = <Wave>.readframes(nframes)        # Returns all frames if `-1` is passed.
<Wave> = wave.open('<path>', 'wb')          # Creates/truncates a file for writing.
<Wave>.setframerate(<int>)                  # Pass 44100, or 48000 for video track.
<Wave>.setnchannels(<int>)                  # Pass 1 for mono, 2 for stereo signal.
<Wave>.setsampwidth(<int>)                  # Pass 2 for CD, 3 for hi-res quality.
<Wave>.setparams(<tuple>)                   # Passed tuple must contain all params.
<Wave>.writeframes(<bytes>)                 # Appends passed frames to audio file.
  • The bytes object contains a sequence of frames, each consisting of one or more samples.
  • In stereo signal, first sample of a frame belongs to the left channel (second to the right).
  • Each sample consists of one or more bytes (depending on sample width) that, when con­verted to an integer, indicate the displacement of a speaker membrane at that moment.
  • If sample width is one byte, then the integer should be encoded unsigned. For all other sizes, the integer should be encoded signed with little-endian byte order.

Sample Values

┏━━━━━━━━━━━┯━━━━━━━━━━━┯━━━━━━┯━━━━━━━━━━━┓
┃ sampwidth │    min    │ zero │    max    ┃
┠───────────┼───────────┼──────┼───────────┨
┃     10128255 ┃
┃     2-32768032767 ┃
┃     3-838860808388607 ┃
┗━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━┷━━━━━━━━━━━┛

Read Float Samples from WAV File

def read_wav_file(filename):
    def get_int(bytes_obj):
        an_int = int.from_bytes(bytes_obj, 'little', signed=(p.sampwidth != 1))
        return an_int - (128 * (p.sampwidth == 1))
    with wave.open(filename) as file:
        p = file.getparams()
        frames = file.readframes(-1)
    samples_b = (frames[i : i + p.sampwidth] for i in range(0, len(frames), p.sampwidth))
    return [get_int(b) / pow(2, (p.sampwidth * 8) - 1) for b in samples_b], p

Write Float Samples to WAV File

def write_to_wav_file(filename, samples_f, p=None, nchannels=1, sampwidth=2, fs=44100):
    def get_bytes(a_float):
        a_float = max(-1, min(1 - 2e-16, a_float)) + (p.sampwidth == 1)
        a_float *= pow(2, (p.sampwidth * 8) - 1)
        return int(a_float).to_bytes(p.sampwidth, 'little', signed=(p.sampwidth != 1))
    if p is None:
        p = wave._wave_params(nchannels, sampwidth, fs, 0, 'NONE', 'not compressed')
    with wave.open(filename, 'wb') as file:
        file.setparams(p)
        file.writeframes(b''.join(get_bytes(f) for f in samples_f))

Examples

Saves a 440 Hz sine wave to a mono WAV file:

from math import sin, pi
get_sin = lambda i: sin(i * 2 * pi * 440 / 44100) * 0.2
write_to_wav_file('test.wav', (get_sin(i) for i in range(100_000)))

Adds noise to the WAV file:

from random import uniform
samples_f, prms = read_wav_file('test.wav')
samples_f = (f + uniform(-0.02, 0.02) for f in samples_f)
write_to_wav_file('test.wav', samples_f, p=prms)

Audio Player

# $ pip3 install nava
from nava import play
play('test.wav')

Text to Speech

# $ pip3 install piper-tts sounddevice
import os, piper, sounddevice
os.system('python3 -m piper.download_voices en_US-lessac-high')
voice = piper.PiperVoice.load('en_US-lessac-high.onnx')
for sentence in voice.synthesize('Sally sells seashells by the seashore.'):
    sounddevice.wait()
    sounddevice.play(sentence.audio_float_array, sentence.sample_rate)
sounddevice.wait()

#Synthesizer

Plays Popcorn by Gershon Kingsley:

# $ pip3 install numpy sounddevice
import itertools as it, math, numpy as np, sounddevice

def play_notes(notes, bpm=132, fs=44100, volume=0.1):
    beat_len  = 60/bpm * fs
    get_pause = lambda n_beats: it.repeat(0, int(n_beats * beat_len))
    get_sinus = lambda i, hz: math.sin(i * 2 * math.pi * hz / fs) * volume
    get_wave  = lambda hz, n_beats: (get_sinus(i, hz) for i in range(int(n_beats * beat_len)))
    get_hertz = lambda note: 440 * 2 ** ((int(note[:2]) - 69) / 12)
    get_beats = lambda note: 1/2 if '♩' in note else 1/4 if '♪' in note else 1
    get_samps = lambda n: get_wave(get_hertz(n), get_beats(n)) if n else get_pause(1/4)
    samples_f = it.chain(get_pause(1/2), *(get_samps(n) for n in notes.split(',')))
    sounddevice.play(np.fromiter(samples_f, np.float32), fs, blocking=True)

play_notes('83♩,81♪,,83♪,,78♪,,74♪,,78♪,,71♪,,,,83♪,,81♪,,83♪,,78♪,,74♪,,78♪,,71♪,,,,'
           '83♩,85♪,,86♪,,85♪,,86♪,,83♪,,85♩,83♪,,85♪,,81♪,,83♪,,81♪,,83♪,,79♪,,83♪,,,,')

#Pygame

Opens a window and draws a square that can be moved with arrow keys:

# $ pip3 install pygame
import pygame as pg

pg.init()
screen = pg.display.set_mode((500, 500))
rect = pg.Rect(240, 240, 20, 20)
while not pg.event.get(pg.QUIT):
    for event in pg.event.get(pg.KEYDOWN):
        dx = (event.key == pg.K_RIGHT) - (event.key == pg.K_LEFT)
        dy = (event.key == pg.K_DOWN) - (event.key == pg.K_UP)
        rect = rect.move((dx * 20, dy * 20))
    screen.fill(pg.Color('black'))
    pg.draw.rect(screen, pg.Color('white'), rect)
    pg.display.flip()
pg.quit()

Rect

Object for storing rectangular coordinates.

<Rect> = pg.Rect(x, y, width, height)           # Creates Rect object. Truncates passed floats.
<int>  = <Rect>.x/y/centerx/centery/…           # `top/right/bottom/left`. Allows assignments.
<tup.> = <Rect>.topleft/center/…                # `topright/bottomright/bottomleft/size`. Same.
<Rect> = <Rect>.move((delta_x, delta_y))        # Use move_ip() to move the rectangle in-place.
<bool> = <Rect>.collidepoint((x, y))            # Returns True if rectangle contains the point.
<bool> = <Rect>.colliderect(<Rect>)             # Returns True if the rectangles are colliding.
<int>  = <Rect>.collidelist(<list_of_Rect>)     # Returns index of first colliding Rect or -1.
<list> = <Rect>.collidelistall(<list_of_Rect>)  # Returns indices of all colliding rectangles.

Surface

Object for representing images.

<Surf> = pg.display.set_mode((width, height))   # Opens new window and returns surface object.
<Surf> = pg.Surface((width, height))            # New RGB surface. RGBA if `flags=pg.SRCALPHA`.
<Surf> = pg.image.load(<path/file>)             # Loads the image. Also get_width/get_height().
<Surf> = pg.surfarray.make_surface(<np_array>)  # Also `<np_arr> = surfarray.pixels3d(<Surf>)`.
<Surf> = <Surf>.subsurface(<Rect>)              # Creates a new surface object from the cutout.
<Surf>.fill(color)                              # Pass tuple of ints or pg.Color('<name/hex>').
<Surf>.set_at((x, y), color)                    # Updates a pixel. Also <Surf>.get_at((x, y)).
<Surf>.blit(<Surf>, (x, y))                     # Draws passed surface at a specified location.
from pygame.transform import scale, rotate      # Also flip, smoothscale, scale_by, rotozoom.
<Surf> = scale(<Surf>, (width, height))         # Scales the surface. `smoothscale()` blurs it.
<Surf> = rotate(<Surf>, angle)                  # Rotates the surface for counterclock degrees.
<Surf> = flip(<Surf>, flip_x=True)              # Mirrors over the y axis. Also `flip_y=True`.
from pygame.draw import line, arc, rect         # Also ellipse, circle, polygon, lines, aaline.
line(<Surf>, color, (x1, y1), (x2, y2))         # Draws line to surface. Accepts `width=<int>`.
arc(<Surf>, color, <Rect>, from_rad, to_rad)    # Also ellipse(<Surf>, color, <Rect>, width=0).
rect(<Surf>, color, <Rect>, width=0)            # Also polygon(<Surf>, color, points, width=0).
<Font> = pg.font.Font(<path/file>, size)        # Loads a TTF file. Pass None for default font.
<Surf> = <Font>.render(text, antialias, color)  # Accepts background color via fourth argument.

Sound

<Sound> = pg.mixer.Sound(<path/file/bytes>)     # Accepts WAV file or array of short integers.
<Sound>.play/stop()                             # Also set_volume(<float>) and fadeout(msec).

Basic Mario Brothers Example

import collections, dataclasses, enum, io, itertools as it, pygame as pg, urllib.request
from random import randint

P = collections.namedtuple('P', 'x y')          # Position (x and y coordinates).
D = enum.Enum('D', 'n e s w')                   # Direction (north, east, etc.).
W, H, MAX_S = 50, 50, P(5, 10)                  # Width, height, maximum speed.

def main():
    def get_screen():
        pg.init()
        return pg.display.set_mode((W*16, H*16))
    def get_images():
        url = 'https://gto76.github.io/python-cheatsheet/web/mario_bros.png'
        img = pg.image.load(io.BytesIO(urllib.request.urlopen(url).read()))
        return [img.subsurface(get_rect(x, 0)) for x in range(img.get_width() // 16)]
    def get_mario():
        Mario = dataclasses.make_dataclass('Mario', 'rect spd facing_left frame_cycle'.split())
        return Mario(get_rect(1, 1), P(0, 0), False, it.cycle(range(3)))
    def get_tiles():
        border = [(x, y) for x in range(W) for y in range(H) if x in [0, W-1] or y in [0, H-1]]
        platforms = [(randint(1, W-2), randint(2, H-2)) for _ in range(W*H // 10)]
        return [get_rect(x, y) for x, y in border + platforms]
    def get_rect(x, y):
        return pg.Rect(x*16, y*16, 16, 16)
    run(get_screen(), get_images(), get_mario(), get_tiles())

def run(screen, images, mario, tiles):
    clock = pg.time.Clock()
    pressed = set()
    while not pg.event.get(pg.QUIT):
        clock.tick(28)
        pressed |= {e.key for e in pg.event.get(pg.KEYDOWN)}
        pressed -= {e.key for e in pg.event.get(pg.KEYUP)}
        update_speed(mario, tiles, pressed)
        update_position(mario, tiles)
        draw(screen, images, mario, tiles)
    pg.quit()

def update_speed(mario, tiles, pressed):
    x, y = mario.spd
    x += 2 * ((pg.K_RIGHT in pressed) - (pg.K_LEFT in pressed))
    x += (x < 0) - (x > 0)
    y += 1 if D.s not in get_boundaries(mario.rect, tiles) else (pg.K_UP in pressed) * -10
    mario.spd = P(x=max(-MAX_S.x, min(MAX_S.x, x)), y=max(-MAX_S.y, min(MAX_S.y, y)))

def update_position(mario, tiles):
    x, y = mario.rect.topleft
    n_steps = max(abs(s) for s in mario.spd)
    for _ in range(n_steps):
        mario.spd = stop_on_collision(mario.spd, get_boundaries(mario.rect, tiles))
        mario.rect.topleft = x, y = x + (mario.spd.x / n_steps), y + (mario.spd.y / n_steps)

def get_boundaries(rect, tiles):
    deltas = {D.n: P(0, -1), D.e: P(1, 0), D.s: P(0, 1), D.w: P(-1, 0)}
    return {d for d, delta in deltas.items() if rect.move(delta).collidelist(tiles) != -1}

def stop_on_collision(spd, bounds):
    return P(x=0 if (D.w in bounds and spd.x < 0) or (D.e in bounds and spd.x > 0) else spd.x,
             y=0 if (D.n in bounds and spd.y < 0) or (D.s in bounds and spd.y > 0) else spd.y)

def draw(screen, images, mario, tiles):
    screen.fill((85, 168, 255))
    mario.facing_left = mario.spd.x < 0 if mario.spd.x else mario.facing_left
    is_airborne = D.s not in get_boundaries(mario.rect, tiles)
    image_index = 4 if is_airborne else next(mario.frame_cycle) if mario.spd.x else 6
    screen.blit(images[image_index + (mario.facing_left * 9)], mario.rect)
    for tile in tiles:
        is_border = tile.x in [0, (W-1)*16] or tile.y in [0, (H-1)*16]
        screen.blit(images[18 if is_border else 19], tile)
    pg.display.flip()

if __name__ == '__main__':
    main()

#Pandas

Data analysis library. For examples see Plotly.

# $ pip3 install pandas matplotlib
import pandas as pd, matplotlib.pyplot as plt

Series

Ordered dictionary with a name.

>>> s = pd.Series([1, 2], index=['x', 'y'], name='a'); s
x    1
y    2
Name: a, dtype: int64
<S>  = pd.Series(<list>)                       # Uses list's indices for 'index'.
<S>  = pd.Series(<dict>)                       # Uses dictionary's keys for 'index'.
<el> = <S>.loc[key]                            # Or: <S>.iloc[i]
<S>  = <S>.loc[coll_of_keys]                   # Or: <S>.iloc[coll_of_i]
<S>  = <S>.loc[from_key : to_key_inc]          # Or: <S>.iloc[from_i : to_i_exc]
<el> = <S>[key/i]                              # Or: <S>.<key>
<S>  = <S>[coll_of_keys/coll_of_i]             # Or: <S>[key/i : key/i]
<S>  = <S>[<S_of_bools>]                       # Or: <S>.loc/iloc[<S_of_bools>]
<S>  = <S> > <el/S>                            # Returns S of bools. For logic use &, |, ~.
<S>  = <S> + <el/S>                            # Items with non-matching keys get value NaN.
<S>  = <S>.head/describe/sort_values()         # Also <S>.unique/value_counts/round/dropna().
<S>  = <S>.str.strip/lower/contains/replace()  # Also split().str[i] or split(expand=True).
<S>  = <S>.dt.year/month/day/hour              # Use pd.to_datetime(<S>) to get S of datetimes.
<S>  = <S>.dt.to_period('y/m/d/h')             # Quantizes datetimes into Period objects.
<S>.plot.line/area/bar/pie/hist()              # Generates a plot. Accepts `title=<str>`.
plt.show()                                     # Displays the plot. Also plt.savefig(<path>).
  • Use 'print(<S>.to_string())' to print a Series that has more than sixty items.
  • Use '<S>.index' to get collection of keys and '<S>.index = <coll>' to update them.
  • Only pass a list or Series to loc/iloc because 'obj[x, y]' is converted to 'obj[(x, y)]' and '<S>.loc[key_1, key_2]' is how you retrieve a value from a multi-indexed Series.
  • Pandas uses NumPy types like 'np.int64'. Series is converted to 'float64' if np.nan is assigned to any item. Use '<S>.astype(<str/type>)' to get converted Series.

Series — Aggregate, Transform, Map:

<el> = <S>.sum/max/mean/std/idxmax/count()     # Or: <S>.agg(lambda <S>: <el>)
<S>  = <S>.rank/diff/cumsum/ffill/interpol…()  # Or: <S>.agg/transform(lambda <S>: <S>)
<S>  = <S>.isna/fillna/isin([<el/coll>])       # Or: <S>.agg/transform/map(lambda <el>: <el>)
┏━━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓
┃              │    'sum'    │   ['sum']   │ {'s': 'sum'}  ┃
┠──────────────┼─────────────┼─────────────┼───────────────┨
┃ s.apply(…)   │      3      │    sum  3   │     s  3      ┃
┃ s.agg(…)     │             │             │               ┃
┗━━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛

┏━━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓
┃              │    'rank'   │   ['rank']  │ {'r': 'rank'} ┃
┠──────────────┼─────────────┼─────────────┼───────────────┨
┃ s.apply(…)   │             │      rank   │               ┃
┃ s.agg(…)     │    x  1.0   │   x   1.0   │   r  x  1.0   ┃
┃              │    y  2.0   │   y   2.0   │      y  2.0   ┃
┗━━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛

DataFrame

Table with labeled rows and columns.

>>> df = pd.DataFrame([[1, 2], [3, 4]], index=['a', 'b'], columns=['x', 'y']); df
   x  y
a  1  2
b  3  4
<DF>   = pd.DataFrame(<list_of_rows>)          # Rows can be either lists, dicts or series.
<DF>   = pd.DataFrame(<dict_of_columns>)       # Columns can be either lists, dicts or series.
<el>   = <DF>.loc[row_key, col_key]            # Or: <DF>.iloc[row_i, col_i]
<S/DF> = <DF>.loc[row_key/s]                   # Or: <DF>.iloc[row_i/s]
<S/DF> = <DF>.loc[:, col_key/s]                # Or: <DF>.iloc[:, col_i/s]
<DF>   = <DF>.loc[row_bools, col_bools]        # Or: <DF>.iloc[row_bools, col_bools]
<S/DF> = <DF>[col_key/s]                       # Or: <DF>.<col_key>
<DF>   = <DF>[<S_of_bools>]                    # Filters rows. For example `df[df.x > 1]`.
<DF>   = <DF>[<DF_of_bools>]                   # Assigns NaN to items that are False in bools.
<DF>   = <DF> > <el/S/DF>                      # Returns DF of bools. Treats series as a row.
<DF>   = <DF> + <el/S/DF>                      # Items with non-matching keys get value NaN.
<DF>   = <DF>.set_index(col_key)               # Replaces row keys with column's values.
<DF>   = <DF>.reset_index(drop=False)          # Drops or moves row keys to column named index.
<DF>   = <DF>.sort_index(ascending=True)       # Sorts rows by row keys. Use `axis=1` for cols.
<DF>   = <DF>.sort_values(col_key/s)           # Sorts rows by passed column/s. Also `axis=1`.
<DF>   = <DF>.head/tail/sample(<int>)          # Returns first, last, or random n rows.
<DF>   = <DF>.describe()                       # Describes columns. Also info(), corr(), shape.
<DF>   = <DF>.query('<query>')                 # Filters rows. For example `df.query('x > 1')`.
<DF>.plot.line/area/bar/scatter(x=col_key, …)  # `y=col_key/s`. Also hist/box(column/by=col_k).
plt.show()                                     # Displays the plot. Also plt.savefig(<path>).

DataFrame — Merge, Join, Concat:

>>> df_2 = pd.DataFrame([[4, 5], [6, 7]], index=['b', 'c'], columns=['y', 'z']); df_2
   y  z
b  4  5
c  6  7
┏━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃                       │    'outer''inner''left'   │       Description         ┃
┠───────────────────────┼───────────────┼────────────┼────────────┼───────────────────────────┨
┃ df.merge(df_2,        │    x   y   z  │ x   y   z  │ x   y   z  │ Merges on column if 'on'  ┃
┃          on='y',      │ 0  1   2   .  │ 3   4   51   2   .  │ or 'left_on/right_on' are ┃
┃          how=…)       │ 1  3   4   5  │            │ 3   4   5  │ set, else on shared cols. ┃
┃                       │ 2  .   6   7  │            │            │ Uses 'inner' by default.  ┃
┠───────────────────────┼───────────────┼────────────┼────────────┼───────────────────────────┨
┃ df.join(df_2,         │    x yl yr  z │            │ x yl yr  z │ Merges on row keys.       ┃
┃         lsuffix='l',  │ a  1  2  .  . │ x yl yr  z │ 1  2  .  . │ Uses 'left' by default.   ┃
┃         rsuffix='r',  │ b  3  4  4  53  4  4  53  4  4  5 │ If Series is passed, it   ┃
┃         how=…)        │ c  .  .  6  7 │            │            │ is treated as a column.   ┃
┠───────────────────────┼───────────────┼────────────┼────────────┼───────────────────────────┨
┃ pd.concat([df, df_2], │    x   y   z  │     y      │            │ Adds rows at the bottom.  ┃
┃           axis=0,     │ a  1   2   .  │     2      │            │ Uses 'outer' by default.  ┃
┃           join=…)     │ b  3   4   .  │     4      │            │ A Series is treated as a  ┃
┃                       │ b  .   4   54      │            │ column. To add a row use  ┃
┃                       │ c  .   6   76      │            │ pd.concat([df, DF([s])]). ┃
┠───────────────────────┼───────────────┼────────────┼────────────┼───────────────────────────┨
┃ pd.concat([df, df_2], │    x  y  y  z │            │            │ Adds columns at the       ┃
┃           axis=1,     │ a  1  2  .  . │ x  y  y  z │            │ right end. Uses 'outer'   ┃
┃           join=…)     │ b  3  4  4  53  4  4  5 │            │ by default. A Series is   ┃
┃                       │ c  .  .  6  7 │            │            │ treated as a column.      ┃
┗━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

DataFrame — Aggregate, Transform, Map:

<S>  = <DF>.sum/max/mean/std/idxmax/count()    # Or: <DF>.apply/agg(lambda <S>: <el>)
<DF> = <DF>.rank/diff/cumsum/ffill/interpo…()  # Or: <DF>.apply/agg/transform(lambda <S>: <S>)
<DF> = <DF>.isna/fillna/isin([<el/coll>])      # Or: <DF>.applymap(lambda <el>: <el>)
┏━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓
┃                 │     'sum'     │    ['sum']    │ {'x': 'sum'}  ┃
┠─────────────────┼───────────────┼───────────────┼───────────────┨
┃ df.apply(…)     │      x  4     │        x  y   │     x  4      ┃
┃ df.agg(…)       │      y  6     │   sum  4  6   │               ┃
┗━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛

┏━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓
┃                 │     'rank'    │    ['rank']   │ {'x': 'rank'} ┃
┠─────────────────┼───────────────┼───────────────┼───────────────┨
┃ df.apply(…)     │               │       x    y  │               ┃
┃ df.agg(…)       │       x    y  │    rank rank  │         x     ┃
┃ df.transform(…) │  a  1.0  1.0  │  a  1.0  1.0  │    a  1.0     ┃
┃                 │  b  2.0  2.0  │  b  2.0  2.0  │    b  2.0     ┃
┗━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛
  • Listed methods process the columns unless they receive 'axis=1'. Exceptions to this rule are '<DF>.dropna()', '<DF>.drop(row_key/s)' and '<DF>.rename(<dict/func>)'.
  • Fifth result's columns are indexed with a multi-index. This means we need a tuple of column keys to specify a column: '<DF>.loc[row_key, (col_key_1, col_key_2)]'.

Multi-Index

<DF> = <DF>.loc[row_key_1]                     # Or: <DF>.xs(row_key_1)
<DF> = <DF>.loc[:, (slice(None), col_key_2)]   # Or: <DF>.xs(col_key_2, axis=1, level=1)
<DF> = <DF>.set_index(col_keys)                # Creates index from cols. Also `append=False`.
<DF> = <DF>.pivot_table(index=col_key/s)       # `columns=key/s, values=key/s, aggfunc='mean'`.
<S>  = <DF>.stack/unstack(level=-1)            # Combines col keys with row keys or vice versa.

File Formats

<S/DF> = pd.read_json/pickle(<path/url/file>)  # Also io.StringIO(<str>), io.BytesIO(<bytes>).
<DF>   = pd.read_csv/excel(<path/url/file>)    # Also `header/index_col/dtype/usecols/…=<obj>`.
<list> = pd.read_html(<path/url/file>)         # Raises ImportError if webpage has zero tables.
<S/DF> = pd.read_parquet/feather/hdf(<path…>)  # Function read_hdf() accepts `key=<s/df_name>`.
<DF>   = pd.read_sql('<table/query>', <conn>)  # Pass SQLite3/Alchemy connection. See #SQLite.
<DF>.to_json/csv/html/latex/parquet(<path>)    # Returns a string/bytes if path is omitted.
<DF>.to_pickle/excel/feather/hdf(<path>)       # Method to_hdf() requires `key=<s/df_name>`.
<DF>.to_sql('<table_name>', <connection>)      # Also `if_exists='fail/replace/append'`.
  • '$ pip3 install "pandas[excel]" odfpy lxml pyarrow' installs dependencies.
  • Csv functions use the same dialect as standard library's csv module (e.g. 'sep=","').
  • Read_csv() only parses dates of columns that are listed in 'parse_dates'. It automatically tries to detect the format, but it can be helped with 'date_format' or 'dayfirst' arguments.
  • We get a dataframe with DatetimeIndex if 'parse_dates' argument includes 'index_col'. Its 'resample("y/m/d/h")' method returns Resampler object that is similar to GroupBy.

GroupBy

Object that groups together rows of a dataframe based on the value of the passed column.

<GB> = <DF>.groupby(col_key/s)                 # Splits DF into groups based on passed column.
<DF> = <GB>.apply/filter(<func>)               # Filter drops a group if func returns False.
<DF> = <GB>.get_group(<el>)                    # Selects a group by grouping column's value.
<S>  = <GB>.size()                             # S of group sizes. Same keys as get_group().
<GB> = <GB>[col_key]                           # Single column GB. All operations return S.
<DF> = <GB>.sum/max/mean/std/idxmax/count()    # Or: <GB>.agg(lambda <S>: <el>)
<DF> = <GB>.rank/diff/cumsum/ffill()           # Or: <GB>.transform(lambda <S>: <S>)
<DF> = <GB>.fillna(<el>)                       # Or: <GB>.transform(lambda <S>: <S>)

Divides rows into groups and sums their columns. Result has a named index that creates column 'z' on reset_index():

>>> df = pd.DataFrame([[1, 2, 3], [4, 5, 6], [7, 8, 6]], list('abc'), list('xyz'))
>>> gb = df.groupby('z'); gb.apply(print)
   x  y  z
a  1  2  3
   x  y  z
b  4  5  6
c  7  8  6
>>> gb.sum()
    x   y
z
3   1   2
6  11  13

Rolling

Object for rolling window calculations.

<RS/RDF/RGB> = <S/DF/GB>.rolling(win_size)     # Also: `min_periods=None, center=False`.
<RS/RDF/RGB> = <RDF/RGB>[col_key/s]            # Or: <RDF/RGB>.<col_key>
<S/DF>       = <R>.mean/sum/max()              # Or: <R>.apply/agg(<agg_func/str>)

#Plotly

# $ pip3 install plotly kaleido pandas
import plotly.express as px, pandas as pd
<Fig> = px.line(<DF> [, y=col_key/s [, x=col_key]])   # Also px.line(y=<list> [, x=<list>]).
<Fig>.update_layout(paper_bgcolor='#rrggbb')          # Also `margin=dict(t=0, r=0, b=0, l=0)`.
<Fig>.write_html/json/image('<path>')                 # Use <Fig>.show() to display the plot.
<Fig> = px.area/bar/box(<DF>, x=col_key, y=col_keys)  # Also `color=col_key`. All are optional.
<Fig> = px.scatter(<DF>, x=col_key, y=col_keys)       # Also `color/size/symbol=col_key`. Same.
<Fig> = px.scatter_3d(<DF>, x=col_key, y=col_key, …)  # `z=col_key`. Also color, size, symbol.
<Fig> = px.histogram(<DF>, x=col_keys, y=col_key)     # Also color, nbins. All are optional.

Displays a line chart of total COVID-19 deaths per million grouped by continent:

covid = pd.read_csv('https://raw.githubusercontent.com/owid/covid-19-data/8dde8ca49b'
                    '6e648c17dd420b2726ca0779402651/public/data/owid-covid-data.csv',
                    usecols=['iso_code', 'date', 'population', 'total_deaths'])
continents = pd.read_csv('https://gto76.github.io/python-cheatsheet/web/continents.csv',
                         usecols=['Three_Letter_Country_Code', 'Continent_Name'])
df = pd.merge(covid, continents, left_on='iso_code', right_on='Three_Letter_Country_Code')
df = df.groupby(['Continent_Name', 'date']).sum().reset_index()
df['Total Deaths per Million'] = df.total_deaths * 1e6 / df.population
df = df[df.date > '2020-03-14']
df = df.rename({'date': 'Date', 'Continent_Name': 'Continent'}, axis='columns')
px.line(df, x='Date', y='Total Deaths per Million', color='Continent')

Displays a multi-axis line chart of total COVID-19 cases and changes in prices of Bitcoin, Dow Jones and gold:

# $ pip3 install pandas lxml selenium plotly
import pandas as pd, selenium.webdriver, io, plotly.graph_objects as go

def main():
    covid, (bitcoin, gold, dow) = get_covid_cases(), get_tickers()
    df = wrangle_data(covid, bitcoin, gold, dow)
    display_data(df)

def get_covid_cases():
    url = 'https://catalog.ourworldindata.org/garden/covid/latest/compact/compact.csv'
    df = pd.read_csv(url, parse_dates=['date'])
    df = df[df.country == 'World']
    s = df.set_index('date').total_cases
    return s.rename('Total Cases')

def get_tickers():
    with selenium.webdriver.Chrome() as driver:
        driver.implicitly_wait(10)
        symbols = {'Bitcoin': 'BTC-USD', 'Gold': 'GC=F', 'Dow Jones': '%5EDJI'}
        return [get_ticker(driver, name, symbol) for name, symbol in symbols.items()]

def get_ticker(driver, name, symbol):
    url = f'https://finance.yahoo.com/quote/{symbol}/history/'
    driver.get(url + '?period1=1579651200&period2=9999999999')
    if buttons := driver.find_elements('xpath', '//button[@name="reject"]'):
        buttons[0].click()
    html = io.StringIO(driver.page_source)
    dataframes = pd.read_html(html, parse_dates=['Date'])
    s = dataframes[0].set_index('Date').Open
    return s.rename(name)

def wrangle_data(covid, bitcoin, gold, dow):
    df = pd.concat([bitcoin, gold, dow], axis=1)  # Creates table by joining columns on dates.
    df = df.sort_index().interpolate()            # Sorts rows by date and interpolates NaN-s.
    df = df.loc['2020-02-23':'2021-12-20']        # Keeps rows between specified dates.
    df = (df / df.iloc[0]) * 100                  # Calculates percentages relative to day 1.
    df = df.join(covid)                           # Adds column with covid cases.
    return df.sort_values(df.index[-1], axis=1)   # Sorts columns by last day's value.

def display_data(df):
    figure = go.Figure()
    for col_name in reversed(df.columns):
        yaxis = 'y1' if col_name == 'Total Cases' else 'y2'
        trace = go.Scatter(x=df.index, y=df[col_name], yaxis=yaxis, name=col_name)
        figure.add_trace(trace)
    figure.update_layout(
        width=944,
        height=423,
        yaxis1=dict(title='Total Cases', rangemode='tozero'),
        yaxis2=dict(title='%', rangemode='tozero', overlaying='y', side='right'),
        colorway=['#EF553B', '#636EFA', '#00CC96', '#FFA152'],
        legend=dict(x=1.08)
    )
    figure.show()

if __name__ == '__main__':
    main()

#Appendix

Cython

Library that compiles Python-like code into C.

# $ pip3 install cython
import pyximport; pyximport.install()                # Module that runs Cython scripts.
import <cython_script>                               # Script must have '.pyx' extension.

All 'cdef' definitions are optional, but they contribute to the speed-up:

cdef <type> <var_name> [= <obj/var>]                 # Either Python or C type variable.
cdef <ctype> *<pointer_name> [= &<var>]              # Use <pointer>[0] to get the value.
cdef <ctype>[size] <array_name> [= <coll/array>]     # Also `<ctype>[:] <mview> = <array>`.
cdef <ctype> *<array_name> [= <coll/array/pointer>]  # E.g. `<<ctype> *> malloc(n_bytes)`.
cdef <type> <func_name>(<type> [*]<arg_name>): ...   # Omitted types default to `object`.
cdef class <class_name>:                             # Also `cdef struct <struct_name>:`.
    cdef public <type> [*]<attr_name>                # Also `... <ctype> [*]<field_name>`.
    def __init__(self, <type> <arg_name>):           # Also `cdef __dealloc__(self):`.
        self.<attr_name> = <arg_name>                # Also `... free(<array/pointer>)`.

Virtual Environments

System for installing libraries directly into project's directory.

$ python3 -m venv NAME         # Creates virtual environment in current directory.
$ source NAME/bin/activate     # Activates it. On Windows run `NAME\Scripts\activate`.
$ pip3 install LIBRARY         # Installs the library into active environment.
$ python3 FILE                 # Runs the script in active environment. Also `./FILE`.
$ deactivate                   # Deactivates the active virtual environment.

Basic Script Template

Run the script with '$ python3 FILE' or '$ chmod u+x FILE; ./FILE'. To automatically start the debugger when uncaught exception occurs run '$ python3 -m pdb -cc FILE'.

#!/usr/bin/env python3
#
# Usage: .py
#

from sys import argv, exit
from collections import defaultdict, namedtuple
from dataclasses import make_dataclass
from enum import Enum
import functools as ft, itertools as it, operator as op, re


def main():
    pass


###
##  UTIL
#

def read_file(filename):
    with open(filename, encoding='utf-8') as file:
        return file.readlines()


if __name__ == '__main__':
    main()

#Index

  • Ctrl+F / ⌘F is usually sufficient.
  • Searching '#<title>' will limit the search to the titles.
  • Click on the title's '#' to get a link to its section.
================================================ FILE: parse.js ================================================ #!/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 the Node.js and npm run: // $ sudo apt install nodejs npm # On macOS use `brew install ...` instead. // // To install dependencies globally, run: // $ npm install -g jsdom jquery showdown highlightjs@9.12.0 // // If running on macOS 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'. // // To avoid problems with permissions and path variables, install modules // into project's directory using: // $ npm install jsdom jquery showdown highlightjs@9.12.0 // // It is also advisable to add a Bash script into .git/hooks directory, that will // run this script before every commit. It should be named 'pre-commit' and it // should contain the following line: `./parse.js`. const fs = require('fs'); const jsdom = require('jsdom'); const showdown = require('showdown'); const hljs = require('highlightjs'); const TOC = '
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\':      [Function, Inline, Import, Decorator, Class, Duck_Type, Enum, Except],\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\':    [Operator, Match_Statement, Logging, Introspection, Threads, Asyncio],\n' +
  '    \'7. Libraries\':   [Progress_Bar, Plot, Table, Console_App, GUI, Scraping, Web, Profile],\n' +
  '    \'8. Multimedia\':  [NumPy, Image, Animation, Audio, Synthesizer, Pygame, Pandas, Plotly]\n' +
  '}\n' +
  '
\n'; const BIN_HEX = '<int> = 0x<hex> # E.g. `0xFf == 255`. Also 0b<bin>.\n' + '<int> = int(\'±<hex>\', 16) # Also int(\'±0x<hex>/±0b<bin>\', 0).\n' + '<str> = hex(<int>) # Returns \'[-]0x<hex>\'. Also bin().\n'; const CACHE = 'from functools import cache\n' + '\n' + '@cache\n' + 'def fib(n):\n' + ' return n if n < 2 else fib(n-2) + fib(n-1)'; const SPLAT = '>>> def add(*a):\n' + '... return sum(a)\n' + '... \n' + '>>> add(1, 2, 3)\n' + '6\n'; const PARAMETRIZED_DECORATOR = 'from functools import wraps\n' + '\n' + 'def debug(print_result=False):\n' + ' def decorator(func):\n' + ' @wraps(func)\n' + ' def out(*args, **kwargs):\n' + ' result = func(*args, **kwargs)\n' + ' print(func.__name__, result if print_result else \'\')\n' + ' return result\n' + ' return out\n' + ' return decorator\n' + '\n' + '@debug(print_result=True)\n' + 'def add(x, y):\n' + ' return x + y\n'; const REPR_USE_CASES = 'f\'{obj!r}\'\n' + 'print/str/repr([obj])\n' + 'print/str/repr({obj: obj})\n' + 'print/str/repr(MyDataClass(obj))\n'; const CONSTRUCTOR_OVERLOADING = 'class <name>:\n' + ' def __init__(self, a=None):\n' + ' self.a = a\n'; const SHUTIL_COPY = 'shutil.copy(from, to) # Copies the file (\'to\' can exist or be a dir).\n' + 'shutil.copy2(from, to) # Also copies the creation and modification time.\n' + 'shutil.copytree(from, to) # Copies the directory (\'to\' should not exist).\n'; const OS_RENAME = 'os.rename(from, to) # Renames or moves the file or directory \'from\'.\n' + 'os.replace(from, to) # Same, but overwrites file \'to\' even on Windows.\n' + 'shutil.move(from, to) # `rename()` that moves into \'to\' if it\'s a dir.\n'; const STRUCT_FORMAT = '\'<n>s\''; const MATCH = 'match <object/expression>:\n' + ' case <pattern> [if <condition>]:\n' + ' <code>\n' + ' ...\n'; const MATCH_EXAMPLE = '>>> from pathlib import Path\n' + '>>> match Path(\'/home/ken/python-cheatsheet/README.md\'):\n' + '... case Path(\n' + '... parts=[\'/\', \'home\', user, *_]\n' + '... ) as p if p.name.lower().startswith(\'readme\') and p.is_file():\n' + '... print(f\'{p.name} is a readme file that belongs to user {user}.\')\n' + 'README.md is a readme file that belongs to user ken.\n'; const COROUTINES = 'import asyncio, collections, curses, curses.textpad, enum, random\n' + '\n' + 'P = collections.namedtuple(\'P\', \'x y\') # Position (x and y coordinates).\n' + 'D = enum.Enum(\'D\', \'n e s w\') # Direction (north, east, etc.).\n' + 'W, H = 15, 7 # Width and height of the field.\n' + '\n' + 'def main(screen):\n' + ' curses.curs_set(0) # Makes the cursor invisible.\n' + ' screen.nodelay(True) # Makes getch() non-blocking.\n' + ' asyncio.run(main_coroutine(screen)) # Starts running asyncio code.\n' + '\n' + 'async def main_coroutine(screen):\n' + ' moves = asyncio.Queue()\n' + ' state = {\'*\': P(0, 0)} | dict.fromkeys(range(10), P(W//2, H//2))\n' + ' ai = [random_controller(id_, moves) for id_ in range(10)]\n' + ' mvc = [controller(screen, moves), model(moves, state), view(state, screen)]\n' + ' tasks = [asyncio.create_task(coro) for coro in ai + mvc]\n' + ' await asyncio.wait(tasks, return_when=asyncio.FIRST_COMPLETED)\n' + '\n' + 'async def random_controller(id_, moves):\n' + ' while True:\n' + ' d = random.choice(list(D))\n' + ' moves.put_nowait((id_, d))\n' + ' await asyncio.sleep(random.triangular(0.01, 0.65))\n' + '\n' + 'async def controller(screen, moves):\n' + ' while True:\n' + ' key_mappings = {258: D.s, 259: D.n, 260: D.w, 261: D.e}\n' + ' if d := key_mappings.get(screen.getch()):\n' + ' moves.put_nowait((\'*\', d))\n' + ' await asyncio.sleep(0.005)\n' + '\n' + 'async def model(moves, state):\n' + ' while state[\'*\'] not in (state[id_] for id_ in range(10)):\n' + ' id_, d = await moves.get()\n' + ' deltas = {D.n: P(0, -1), D.e: P(1, 0), D.s: P(0, 1), D.w: P(-1, 0)}\n' + ' state[id_] = P((state[id_].x + deltas[d].x) % W, (state[id_].y + deltas[d].y) % H)\n' + '\n' + 'async def view(state, screen):\n' + ' offset = P(curses.COLS//2 - W//2, curses.LINES//2 - H//2)\n' + ' while True:\n' + ' screen.erase()\n' + ' curses.textpad.rectangle(screen, offset.y-1, offset.x-1, offset.y+H, offset.x+W)\n' + ' for id_, p in state.items():\n' + ' screen.addstr(offset.y + (p.y - state[\'*\'].y + H//2) % H,\n' + ' offset.x + (p.x - state[\'*\'].x + W//2) % W, str(id_))\n' + ' screen.refresh()\n' + ' await asyncio.sleep(0.005)\n' + '\n' + 'if __name__ == \'__main__\':\n' + ' curses.wrapper(main)\n'; const CURSES = '# $ pip3 install windows-curses\n' + 'import curses, os\n' + 'from curses import A_REVERSE, KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT\n' + '\n' + 'def main(screen):\n' + ' ch, first, selected, paths = 0, 0, 0, os.listdir()\n' + ' while ch != ord(\'q\'):\n' + ' height, width = screen.getmaxyx()\n' + ' screen.erase()\n' + ' for y, filename in enumerate(paths[first : first+height]):\n' + ' color = A_REVERSE if filename == paths[selected] else 0\n' + ' screen.addnstr(y, 0, filename, width-1, color)\n' + ' ch = screen.getch()\n' + ' selected -= (ch == KEY_UP) and (selected > 0)\n' + ' selected += (ch == KEY_DOWN) and (selected < len(paths)-1)\n' + ' first -= (first > selected)\n' + ' first += (first < selected-(height-1))\n' + ' if ch in [KEY_LEFT, KEY_RIGHT, ord(\'\\n\')]:\n' + ' new_dir = \'..\' if ch == KEY_LEFT else paths[selected]\n' + ' if os.path.isdir(new_dir):\n' + ' os.chdir(new_dir)\n' + ' first, selected, paths = 0, 0, os.listdir()\n' + '\n' + 'if __name__ == \'__main__\':\n' + ' curses.wrapper(main)\n'; const PROGRESS_BAR = '# $ pip3 install tqdm\n' + '>>> import tqdm, time\n' + '>>> for el in tqdm.tqdm([1, 2, 3], desc=\'Processing\'):\n' + '... time.sleep(1)\n' + 'Processing: 100%|████████████████████| 3/3 [00:03<00:00, 1.00s/it]\n'; const LOGGING_EXAMPLE = '>>> logger = log.getLogger(\'my_module\')\n' + '>>> handler = log.FileHandler(\'test.log\', encoding=\'utf-8\')\n' + '>>> format_str = \'%(asctime)s %(levelname)s:%(name)s:%(message)s\'\n' + '>>> handler.setFormatter(log.Formatter(format_str))\n' + '>>> logger.addHandler(handler)\n' + '>>> logger.setLevel(\'DEBUG\')\n' + '>>> log.basicConfig()\n' + '>>> roots_handler = log.root.handlers[0]\n' + '>>> roots_handler.setLevel(\'WARNING\')\n' + '>>> logger.critical(\'Missing config file.\')\n' + 'CRITICAL:my_module:Missing config file.\n' + '>>> print(open(\'test.log\').read())\n' + '2023-02-07 23:21:01,430 CRITICAL:my_module:Missing config file.\n'; const AUDIO_1 = 'def write_to_wav_file(filename, samples_f, p=None, nchannels=1, sampwidth=2, fs=44100):\n' + ' def get_bytes(a_float):\n' + ' a_float = max(-1, min(1 - 2e-16, a_float)) + (p.sampwidth == 1)\n' + ' a_float *= pow(2, (p.sampwidth * 8) - 1)\n' + ' return int(a_float).to_bytes(p.sampwidth, \'little\', signed=(p.sampwidth != 1))\n' + ' if p is None:\n' + ' p = wave._wave_params(nchannels, sampwidth, fs, 0, \'NONE\', \'not compressed\')\n' + ' with wave.open(filename, \'wb\') as file:\n' + ' file.setparams(p)\n' + ' file.writeframes(b\'\'.join(get_bytes(f) for f in samples_f))\n'; const AUDIO_2 = 'from math import sin, pi\n' + 'get_sin = lambda i: sin(i * 2 * pi * 440 / 44100) * 0.2\n' + 'write_to_wav_file(\'test.wav\', (get_sin(i) for i in range(100_000)))\n'; const MARIO = 'import collections, dataclasses, enum, io, itertools as it, pygame as pg, urllib.request\n' + 'from random import randint\n' + '\n' + 'P = collections.namedtuple(\'P\', \'x y\') # Position (x and y coordinates).\n' + 'D = enum.Enum(\'D\', \'n e s w\') # Direction (north, east, etc.).\n' + 'W, H, MAX_S = 50, 50, P(5, 10) # Width, height, maximum speed.\n' + '\n' + 'def main():\n' + ' def get_screen():\n' + ' pg.init()\n' + ' return pg.display.set_mode((W*16, H*16))\n' + ' def get_images():\n' + ' url = \'https://gto76.github.io/python-cheatsheet/web/mario_bros.png\'\n' + ' img = pg.image.load(io.BytesIO(urllib.request.urlopen(url).read()))\n' + ' return [img.subsurface(get_rect(x, 0)) for x in range(img.get_width() // 16)]\n' + ' def get_mario():\n' + ' Mario = dataclasses.make_dataclass(\'Mario\', \'rect spd facing_left frame_cycle\'.split())\n' + ' return Mario(get_rect(1, 1), P(0, 0), False, it.cycle(range(3)))\n' + ' def get_tiles():\n' + ' border = [(x, y) for x in range(W) for y in range(H) if x in [0, W-1] or y in [0, H-1]]\n' + ' platforms = [(randint(1, W-2), randint(2, H-2)) for _ in range(W*H // 10)]\n' + ' return [get_rect(x, y) for x, y in border + platforms]\n' + ' def get_rect(x, y):\n' + ' return pg.Rect(x*16, y*16, 16, 16)\n' + ' run(get_screen(), get_images(), get_mario(), get_tiles())\n' + '\n' + 'def run(screen, images, mario, tiles):\n' + ' clock = pg.time.Clock()\n' + ' pressed = set()\n' + ' while not pg.event.get(pg.QUIT):\n' + ' clock.tick(28)\n' + ' pressed |= {e.key for e in pg.event.get(pg.KEYDOWN)}\n' + ' pressed -= {e.key for e in pg.event.get(pg.KEYUP)}\n' + ' update_speed(mario, tiles, pressed)\n' + ' update_position(mario, tiles)\n' + ' draw(screen, images, mario, tiles)\n' + ' pg.quit()\n' + '\n' + 'def update_speed(mario, tiles, pressed):\n' + ' x, y = mario.spd\n' + ' x += 2 * ((pg.K_RIGHT in pressed) - (pg.K_LEFT in pressed))\n' + ' x += (x < 0) - (x > 0)\n' + ' y += 1 if D.s not in get_boundaries(mario.rect, tiles) else (pg.K_UP in pressed) * -10\n' + ' mario.spd = P(x=max(-MAX_S.x, min(MAX_S.x, x)), y=max(-MAX_S.y, min(MAX_S.y, y)))\n' + '\n' + 'def update_position(mario, tiles):\n' + ' x, y = mario.rect.topleft\n' + ' n_steps = max(abs(s) for s in mario.spd)\n' + ' for _ in range(n_steps):\n' + ' mario.spd = stop_on_collision(mario.spd, get_boundaries(mario.rect, tiles))\n' + ' mario.rect.topleft = x, y = x + (mario.spd.x / n_steps), y + (mario.spd.y / n_steps)\n' + '\n' + 'def get_boundaries(rect, tiles):\n' + ' deltas = {D.n: P(0, -1), D.e: P(1, 0), D.s: P(0, 1), D.w: P(-1, 0)}\n' + ' return {d for d, delta in deltas.items() if rect.move(delta).collidelist(tiles) != -1}\n' + '\n' + 'def stop_on_collision(spd, bounds):\n' + ' return P(x=0 if (D.w in bounds and spd.x < 0) or (D.e in bounds and spd.x > 0) else spd.x,\n' + ' y=0 if (D.n in bounds and spd.y < 0) or (D.s in bounds and spd.y > 0) else spd.y)\n' + '\n' + 'def draw(screen, images, mario, tiles):\n' + ' screen.fill((85, 168, 255))\n' + ' mario.facing_left = mario.spd.x < 0 if mario.spd.x else mario.facing_left\n' + ' is_airborne = D.s not in get_boundaries(mario.rect, tiles)\n' + ' image_index = 4 if is_airborne else next(mario.frame_cycle) if mario.spd.x else 6\n' + ' screen.blit(images[image_index + (mario.facing_left * 9)], mario.rect)\n' + ' for tile in tiles:\n' + ' is_border = tile.x in [0, (W-1)*16] or tile.y in [0, (H-1)*16]\n' + ' screen.blit(images[18 if is_border else 19], tile)\n' + ' pg.display.flip()\n' + '\n' + 'if __name__ == \'__main__\':\n' + ' main()\n'; const GROUPBY = '>>> df = pd.DataFrame([[1, 2, 3], [4, 5, 6], [7, 8, 6]], list(\'abc\'), list(\'xyz\'))\n' + '>>> gb = df.groupby(\'z\'); gb.apply(print)\n' + ' x y z\n' + 'a 1 2 3\n' + ' x y z\n' + 'b 4 5 6\n' + 'c 7 8 6\n' + '>>> gb.sum()\n' + ' x y\n' + 'z\n' + '3 1 2\n' + '6 11 13'; const CYTHON_1 = 'cdef <type> <var_name> [= <obj/var>] # Either Python or C type variable.\n' + 'cdef <ctype> *<pointer_name> [= &<var>] # Use <pointer>[0] to get the value.\n' + 'cdef <ctype>[size] <array_name> [= <coll/array>] # Also `<ctype>[:] <mview> = <array>`.\n' + 'cdef <ctype> *<array_name> [= <coll/array/pointer>] # E.g. `<<ctype> *> malloc(n_bytes)`.\n'; const CYTHON_2 = 'cdef <type> <func_name>(<type> [*]<arg_name>): ... # Omitted types default to `object`.\n'; const CYTHON_3 = 'cdef class <class_name>: # Also `cdef struct <struct_name>:`.\n' + ' cdef public <type> [*]<attr_name> # Also `... <ctype> [*]<field_name>`.\n' + ' def __init__(self, <type> <arg_name>): # Also `cdef __dealloc__(self):`.\n' + ' self.<attr_name> = <arg_name> # Also `... free(<array/pointer>)`.\n'; const INDEX = '
  • Ctrl+F / ⌘F is usually sufficient.
  • \n' + '
  • Searching \'#<title>\' will limit the search to the titles.
  • \n' + '
  • Click on the title\'s \'#\' to get a link to its section.
  • \n'; const DIAGRAM_1_A = '+------------------+------------+------------+------------+\n' + '| | Iterable | Collection | Sequence |\n' + '+------------------+------------+------------+------------+\n'; const DIAGRAM_1_B = '┏━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━┓\n' + '┃ │ Iterable │ Collection │ Sequence ┃\n' + '┠──────────────────┼────────────┼────────────┼────────────┨\n' + '┃ list, range, str │ ✓ │ ✓ │ ✓ ┃\n' + '┃ dict, set │ ✓ │ ✓ │ ┃\n' + '┃ iter │ ✓ │ │ ┃\n' + '┗━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┛\n'; const DIAGRAM_2_A = '+--------------------+-----------+-----------+----------+----------+----------+\n' + '| | Number | Complex | Real | Rational | Integral |\n' + '+--------------------+-----------+-----------+----------+----------+----------+\n'; const DIAGRAM_2_B = '┏━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━┓\n' + '┃ │ Number │ Complex │ Real │ Rational │ Integral ┃\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" + "┗━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┛\n" + "\n" + "┏━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┓\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" + "┗━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┛\n"; const DIAGRAM_5_A = "+--------------+----------------+----------------+----------------+----------------+\n" + "| | {:.2} | {:.2f} | {:.2e} | {:.2%} |\n" + "+--------------+----------------+----------------+----------------+----------------+\n"; const DIAGRAM_55_A = "+---------------------------+----------------+--------------+--------------+\n"; const DIAGRAM_55_B = '┏━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━┓\n' + '┃ │ func(x=1, y=2) │ func(1, y=2) │ func(1, 2) ┃\n' + '┠───────────────────────────┼────────────────┼──────────────┼──────────────┨\n' + '┃ func(x, *args, **kwargs): │ ✓ │ ✓ │ ✓ ┃\n' + '┃ func(*args, y, **kwargs): │ ✓ │ ✓ │ ┃\n' + '┃ func(*, x, **kwargs): │ ✓ │ │ ┃\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 when `sys.exit()` is called. See #Exit for details.\n" + " ├── KeyboardInterrupt # Raised when the user hits the interrupt key, i.e. `ctrl-c`.\n" + " └── Exception # User-defined exceptions should be derived from this class.\n" + " ├── ArithmeticError # Base class for arithmetic errors such as ZeroDivisionError.\n" + " ├── AssertionError # Raised by `assert <exp>` if expression returns false value.\n" + " ├── AttributeError # Raised when object doesn't have requested attribute/method.\n" + " ├── EOFError # Raised by `input()` when it hits an end-of-file condition.\n" + " ├── LookupError # Base class for errors when a collection can't find an item.\n" + " │ ├── IndexError # Raised when index of a sequence (list/str) is out of range.\n" + " │ └── KeyError # Raised when a dictionary's key or a set element is missing.\n" + " ├── MemoryError # Out of memory. May be too late to start deleting variables.\n" + " ├── NameError # Raised when nonexistent name (variable/func/class) is used.\n" + " │ └── UnboundLocalError # Raised when a local name is used before it's being defined.\n" + " ├── OSError # Errors such as FileExistsError and TimeoutError. See #Open.\n" + " │ └── ConnectionError # Errors such as BrokenPipeError and ConnectionAbortedError.\n" + " ├── RuntimeError # Is raised by errors that do not fit into other categories.\n" + " │ ├── NotImplementedEr… # Can be raised by abstract methods or by an unfinished code.\n" + " │ └── RecursionError # Raised if max recursion depth is exceeded (3k by default).\n" + " ├── StopIteration # Raised when exhausted (empty) iterator is passed to next().\n" + " ├── TypeError # Raised when argument of wrong type is passed to a function.\n" + " └── ValueError # Raised when it has the right type but inappropriate value.\n"; const DIAGRAM_8_A = '+-----------+------------+------------+------------+\n' + '| | List | Set | Dict |\n' + '+-----------+------------+------------+------------+\n'; const DIAGRAM_8_B = '┏━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━┓\n' + '┃ │ List │ Set │ Dict ┃\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" + "┃ lineterminator │ '\\r\\n' │ '\\r\\n' │ '\\n' ┃\n" + "┃ quotechar │ '\"' │ '\"' │ '\"' ┃\n" + "┃ escapechar │ None │ None │ None ┃\n" + "┃ doublequote │ True │ True │ True ┃\n" + "┃ quoting │ 0 │ 0 │ 1 ┃\n" + "┃ skipinitialspace │ False │ False │ False ┃\n" + "┗━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━┛\n"; const DIAGRAM_95_A = '+-----------------+--------------+----------------------------------+\n' + '| Dialect | pip3 install | Dependencies |\n' + '+-----------------+--------------+----------------------------------+\n'; const DIAGRAM_95_B = '┏━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\n' + '┃ Dialect │ pip3 install │ Dependencies ┃\n' + '┠─────────────────┼──────────────┼──────────────────────────────────┨\n' + '┃ mysql │ mysqlclient │ www.pypi.org/project/mysqlclient ┃\n' + '┃ postgresql │ psycopg2 │ www.pypi.org/project/psycopg2 ┃\n' + '┃ mssql │ pyodbc │ www.pypi.org/project/pyodbc ┃\n' + '┃ oracle+oracledb │ oracledb │ www.pypi.org/project/oracledb ┃\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_115_A = '+--------------+------------+-------------------------------+-------+------+\n' + '| pip3 install | Target | How to run | Lines | Live |\n' + '+--------------+------------+-------------------------------+-------+------+\n'; const DIAGRAM_115_B = '┏━━━━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━┯━━━━━━┓\n' + '┃ pip3 install │ Target │ How to run │ Lines │ Live ┃\n' + '┠──────────────┼────────────┼───────────────────────────────┼───────┼──────┨\n' + '┃ pyinstrument │ CPU │ pyinstrument test.py │ × │ × ┃\n' + '┃ py-spy │ CPU │ py-spy top -- python3 test.py │ × │ ✓ ┃\n' + '┃ scalene │ CPU+Memory │ scalene test.py │ ✓ │ × ┃\n' + '┃ memray │ Memory │ memray run --live test.py │ ✓ │ ✓ ┃\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' + '┗━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━┷━━━━━━━━━━━┛\n'; const DIAGRAM_13_A = '| s.apply(…) | 3 | sum 3 | s 3 |'; const DIAGRAM_13_B = "┏━━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓\n" + "┃ │ 'sum' │ ['sum'] │ {'s': 'sum'} ┃\n" + "┠──────────────┼─────────────┼─────────────┼───────────────┨\n" + "┃ s.apply(…) │ 3 │ sum 3 │ s 3 ┃\n" + "┃ s.agg(…) │ │ │ ┃\n" + "┗━━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛\n" + "\n" + "┏━━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓\n" + "┃ │ 'rank' │ ['rank'] │ {'r': 'rank'} ┃\n" + "┠──────────────┼─────────────┼─────────────┼───────────────┨\n" + "┃ s.apply(…) │ │ rank │ ┃\n" + "┃ s.agg(…) │ x 1.0 │ x 1.0 │ r x 1.0 ┃\n" + "┃ │ y 2.0 │ y 2.0 │ y 2.0 ┃\n" + "┗━━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛\n"; const DIAGRAM_13_BB = "┏━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓\n" + "┃ │ 'mean' │ ['mean'] │ {'m': 'mean'} ┃\n" + "┠────────────────┼─────────────┼─────────────┼───────────────┨\n" + "┃ s.apply/agg(…) │ 1.5 │ mean 1.5 │ m 1.5 ┃\n" + "┗━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛\n" + "\n" + "┏━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓\n" + "┃ │ 'rank' │ ['rank'] │ {'r': 'rank'} ┃\n" + "┠────────────────┼─────────────┼─────────────┼───────────────┨\n" + "┃ s.apply/agg(…) │ │ rank │ ┃\n" + "┃ │ x 1.0 │ x 1.0 │ r x 1.0 ┃\n" + "┃ │ y 2.0 │ y 2.0 │ y 2.0 ┃\n" + "┗━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛\n"; const DIAGRAM_13_XXX = "┏━━━━━━━━━━━━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━┓\n" + "┃ │ 'sum' │ ['sum', 'max'] │ 'rank' │ ['rank', 'diff'] ┃\n" + "┠────────────────┼───────────┼────────────────┼───────────┼──────────────────┨\n" + "┃ s.apply/agg(…) │ 3 │ sum 3 │ x 1.0 │ rank diff ┃\n" + "┃ │ │ max 2 │ y 2.0 │ x 1.0 NaN ┃\n" + "┃ │ │ Name: a │ Name: a │ y 2.0 1.0 ┃\n" + "┗━━━━━━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━┛\n"; const DIAGRAM_13_XX = "┏━━━━━━━━━━━━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┓\n" + "┃ │ 'sum' │ 'rank' │ ['sum', 'max'] ┃\n" + "┠────────────────┼───────────┼───────────┼────────────────┨\n" + "┃ s.apply/agg(…) │ 3 │ x 1.0 │ sum 3 ┃\n" + "┃ │ │ y 2.0 │ max 2 ┃\n" + "┃ │ │ Name: a │ Name: a ┃\n" + "┗━━━━━━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┛\n"; const DIAGRAM_13_X = "┏━━━━━━━━━━━━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━┓\n" + "┃ │ 'sum' │ 'rank' │ ['sum', 'max'] │ ['rank', 'diff'] ┃\n" + "┠────────────────┼───────────┼───────────┼────────────────┼──────────────────┨\n" + "┃ s.apply/agg(…) │ 3 │ x 1.0 │ sum 3 │ rank diff ┃\n" + "┃ │ │ y 2.0 │ max 2 │ x 1.0 NaN ┃\n" + "┃ │ │ Name: a │ Name: a │ y 2.0 1.0 ┃\n" + "┗━━━━━━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━┛\n"; const DIAGRAM_13_Y = "┏━━━━━━━━━━━━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━━┓\n" + "┃ │ 'sum' │ 'rank' │ ['sum'] │ ['rank'] ┃\n" + "┠────────────────┼───────────┼───────────┼───────────┼───────────┨\n" + "┃ s.apply/agg(…) │ 3 │ x 1.0 │ sum 3 │ rank ┃\n" + "┃ │ │ y 2.0 │ Name: a │ x 1.0 ┃\n" + "┃ │ │ Name: a │ │ y 2.0 ┃\n" + "┗━━━━━━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━┛\n"; const DIAGRAM_13_BBB = "┏━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓\n" + "┃ │ 'sum' │ ['sum'] │ {'s': 'sum'} ┃\n" + "┠────────────────┼─────────────┼─────────────┼───────────────┨\n" + "┃ s.apply/agg(…) │ 3 │ sum 3 │ s 3 ┃\n" + "┗━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛\n" + "\n" + "┏━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓\n" + "┃ │ 'rank' │ ['rank'] │ {'r': 'rank'} ┃\n" + "┠────────────────┼─────────────┼─────────────┼───────────────┨\n" + "┃ s.apply/agg(…) │ │ rank │ ┃\n" + "┃ │ x 1.0 │ x 1.0 │ r x 1.0 ┃\n" + "┃ │ y 2.0 │ y 2.0 │ y 2.0 ┃\n" + "┗━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛\n"; const DIAGRAM_14_A = "| | 'rank' | ['rank'] | {'r': 'rank'} |"; const DIAGRAM_15_A = '+-----------------------+---------------+------------+------------+---------------------------+'; const DIAGRAM_15_B = "┏━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\n" + "┃ │ 'outer' │ 'inner' │ 'left' │ Description ┃\n" + "┠───────────────────────┼───────────────┼────────────┼────────────┼───────────────────────────┨\n" + "┃ df.merge(df_2, │ x y z │ x y z │ x y z │ Merges on column if 'on' ┃\n" + "┃ on='y', │ 0 1 2 . │ 3 4 5 │ 1 2 . │ or 'left_on/right_on' are ┃\n" + "┃ how=…) │ 1 3 4 5 │ │ 3 4 5 │ set, else on shared cols. ┃\n" + "┃ │ 2 . 6 7 │ │ │ Uses 'inner' by default. ┃\n" + "┠───────────────────────┼───────────────┼────────────┼────────────┼───────────────────────────┨\n" + "┃ df.join(df_2, │ x yl yr z │ │ x yl yr z │ Merges on row keys. ┃\n" + "┃ lsuffix='l', │ a 1 2 . . │ x yl yr z │ 1 2 . . │ Uses 'left' by default. ┃\n" + "┃ rsuffix='r', │ b 3 4 4 5 │ 3 4 4 5 │ 3 4 4 5 │ If Series is passed, it ┃\n" + "┃ how=…) │ c . . 6 7 │ │ │ is treated as a column. ┃\n" + "┠───────────────────────┼───────────────┼────────────┼────────────┼───────────────────────────┨\n" + "┃ pd.concat([df, df_2], │ 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 │ │ A Series is treated as a ┃\n" + "┃ │ b . 4 5 │ 4 │ │ column. To add a row use ┃\n" + "┃ │ c . 6 7 │ 6 │ │ pd.concat([df, DF([s])]). ┃\n" + "┠───────────────────────┼───────────────┼────────────┼────────────┼───────────────────────────┨\n" + "┃ pd.concat([df, df_2], │ x y y z │ │ │ Adds columns at the ┃\n" + "┃ axis=1, │ a 1 2 . . │ x y y z │ │ right end. Uses 'outer' ┃\n" + "┃ join=…) │ b 3 4 4 5 │ 3 4 4 5 │ │ by default. A Series is ┃\n" + "┃ │ c . . 6 7 │ │ │ treated as a column. ┃\n" + "┗━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━┛\n"; const DIAGRAM_16_A = '| df.apply(…) | x 4 | x y | x 4 |'; const DIAGRAM_16_B = "┏━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓\n" + "┃ │ 'sum' │ ['sum'] │ {'x': 'sum'} ┃\n" + "┠─────────────────┼───────────────┼───────────────┼───────────────┨\n" + "┃ df.apply(…) │ x 4 │ x y │ x 4 ┃\n" + "┃ df.agg(…) │ y 6 │ sum 4 6 │ ┃\n" + "┗━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛\n" + "\n" + "┏━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓\n" + "┃ │ 'rank' │ ['rank'] │ {'x': 'rank'} ┃\n" + "┠─────────────────┼───────────────┼───────────────┼───────────────┨\n" + "┃ df.apply(…) │ │ x y │ ┃\n" + "┃ df.agg(…) │ x y │ rank rank │ x ┃\n" + "┃ df.transform(…) │ a 1.0 1.0 │ a 1.0 1.0 │ a 1.0 ┃\n" + "┃ │ b 2.0 2.0 │ b 2.0 2.0 │ b 2.0 ┃\n" + "┗━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛\n"; const DIAGRAM_17_A = "| | 'rank' | ['rank'] | {'x': 'rank'} |"; const DIAGRAM_18_A = '| gb.agg(…) | x y | | x y | |'; const DIAGRAM_18_B = "┏━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓\n" + "┃ │ 'sum' │ 'rank' │ ['rank'] │ {'x': 'rank'} ┃\n" + "┠─────────────────┼─────────────┼─────────────┼─────────────┼───────────────┨\n" + "┃ gb.agg(…) │ x y │ │ x y │ ┃\n" + "┃ │ z │ x y │ rank rank │ x ┃\n" + "┃ │ 3 1 2 │ a 1 1 │ a 1 1 │ a 1 ┃\n" + "┃ │ 6 11 13 │ b 1 1 │ b 1 1 │ b 1 ┃\n" + "┃ │ │ c 2 2 │ c 2 2 │ c 2 ┃\n" + "┠─────────────────┼─────────────┼─────────────┼─────────────┼───────────────┨\n" + "┃ gb.transform(…) │ x y │ x y │ │ ┃\n" + "┃ │ a 1 2 │ a 1 1 │ │ ┃\n" + "┃ │ b 11 13 │ b 1 1 │ │ ┃\n" + "┃ │ c 11 13 │ c 2 2 │ │ ┃\n" + "┗━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛\n"; const MENU = 'Download text file, Fork me on GitHub, Check out FAQ or Switch to dark theme.\n'; const DARK_THEME_SCRIPT = ''; function main() { const html = getMd(); initDom(html); modifyPage(); var template = readFile('web/template.html'); template = updateDate(template); 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 = removeHyphensFromLinks(readme); const converter = new showdown.Converter(); return converter.makeHtml(readme); } function removeHyphensFromLinks(md) { return md.replace(/\(#([^)]+)\)/g, (_, anchor) => { const match = anchor.match(/^(.*?)(-\d+)?$/); const main = match[1].replace(/-/g, ""); const suffix = match[2] ?? ""; return `(#${main}${suffix})`; }); } function initDom(html) { const { JSDOM } = jsdom; const dom = new JSDOM(html); const $ = (require('jquery'))(dom.window); global.$ = $; global.document = dom.window.document; } function modifyPage() { changeMenu(); addDarkThemeScript(); removeOrigToc(); addToc(); insertLinks(); unindentBanner(); updateDiagrams(); highlightCode(); fixPandasDiagram(); removePlotImages(); fixABCSequenceDiv(); fixStructFormatDiv(); } function changeMenu() { $('sup').first().html(MENU) } function addDarkThemeScript() { $('#main').before(DARK_THEME_SCRIPT); } 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'); montyImg.parent().css({"margin-bottom": "20px", "padding-bottom": "7px"}) 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_4_A})`).html(DIAGRAM_4_B); $(`code:contains(${DIAGRAM_5_A})`).parent().remove(); $(`code:contains(${DIAGRAM_55_A})`).html(DIAGRAM_55_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_95_A})`).html(DIAGRAM_95_B); $(`code:contains(${DIAGRAM_115_A})`).html(DIAGRAM_115_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})`).parent().remove(); $(`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})`).parent().remove(); } function highlightCode() { changeCodeLanguages(); $('code').each(function(index) { hljs.highlightBlock(this); }); fixClasses(); fixHighlights(); preventPageBreaks(); fixPageBreaksFile(); fixPageBreaksStruct(); insertPageBreaks(); } function changeCodeLanguages() { setApaches(['', '', '
    ', '
    ', '', '']); $('code').not('.python').not('.text').not('.bash').not('.apache').addClass('python'); $('code:contains( = <2d>[row_index, col_index])').removeClass().addClass('bash'); $('code:contains(<1d_array> = <2d>[row_indices, col_indices])').removeClass().addClass('bash'); $('code:contains(<2d_bools> = <2d> > )').removeClass().addClass('bash'); $('code.perl').removeClass().addClass('python'); } 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( = 0x)`).html(BIN_HEX); $(`code:contains( + fib(n)`).html(CACHE); $(`code:contains(>>> def add)`).html(SPLAT); $(`code:contains(@debug(print_result=True))`).html(PARAMETRIZED_DECORATOR); $(`code:contains(print/str/repr([obj]))`).html(REPR_USE_CASES); $(`code:contains(shutil.copy)`).html(SHUTIL_COPY); $(`code:contains(os.rename)`).html(OS_RENAME); $(`code:contains(\'s\')`).html(STRUCT_FORMAT); $(`code:contains(match :)`).html(MATCH); $(`code:contains(>>> match Path)`).html(MATCH_EXAMPLE); $(`code:contains(>>> log.basicConfig()`).html(LOGGING_EXAMPLE); $(`code:contains(import asyncio, collections, curses, curses.textpad, enum, random)`).html(COROUTINES); $(`code:contains(pip3 install tqdm)`).html(PROGRESS_BAR); $(`code:contains(import curses, os)`).html(CURSES); $(`code:contains(a_float = max()`).html(AUDIO_1); $(`code:contains(get_sin = )`).html(AUDIO_2); $(`code:contains(collections, dataclasses, enum, io, itertools)`).html(MARIO); $(`code:contains(>>> gb = df.groupby)`).html(GROUPBY); $(`code:contains(cdef [= ])`).html(CYTHON_1); $(`code:contains(cdef ( [*]): ...)`).html(CYTHON_2); $(`code:contains(cdef class :)`).html(CYTHON_3); $(`ul:contains(Ctrl+F / ⌘F is usually sufficient.)`).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 = $('#floatingpointtypesstructalwaysusesstandardsizes').parent().parent().parent().parent() move(formatDiv, 'floatingpointtypesstructalwaysusesstandardsizes') move(formatDiv, 'integersusecapitalletterforunsignedtypeminimumstandardsizesareinbrackets') move(formatDiv, 'forstandardtypesizesandmanualalignmentpaddingstartformatstringwith') } function move(anchor_el, el_id) { const el = $('#'+el_id).parent() anchor_el.after(el) } function insertPageBreaks() { insertPageBreakBefore('#decorator') // 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:contains(if)").after("if"); $(`code:contains(${diagram_15})`).find(".hljs-keyword:contains(or)").after("or"); $(`code:contains(${diagram_15})`).find(".hljs-keyword:contains(else)").after("else"); $(`code:contains(${diagram_15})`).find(".hljs-keyword").remove(); $(`code:contains(${diagram_15})`).find(".hljs-string:contains(\'left_on/right_on\')").after("\'left_on/right_on\'"); $(`code:contains(${diagram_15})`).find(".hljs-string:contains(\'left_on/right_on\')").remove(); $(`code:contains(${diagram_15})`).find(".hljs-string:contains('on')").after("'on'"); $(`code:contains(${diagram_15})`).find(".hljs-string:contains('on')").remove(); } function removePlotImages() { $('img[alt="Covid Deaths"]').remove(); $('img[alt="Covid Cases"]').remove(); } function fixABCSequenceDiv() { $('#abcsequence').parent().insertBefore($('#tableofrequiredandautomaticallyavailablespecialmethods').parent()) } function fixStructFormatDiv() { const div = $('#format-2').parent() $('#format-2').insertBefore(div) $('#forstandardtypesizesandmanualalignmentpaddingstartformatstringwith').parent().insertBefore(div) } function updateDate(template) { const date = new Date(); const date_str = date.toLocaleString('en-us', {month: 'long', day: 'numeric', year: 'numeric'}); template = template.replace('May 20, 2021', date_str); template = template.replace('May 20, 2021', date_str); return template; } // UTIL 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(); ================================================ FILE: pdf/Acrobat/Chapter_1.xml ================================================ /
    | Chapter 1: Collections
    ================================================ FILE: pdf/Acrobat/bottom_line.xml ================================================ /
    __________________________________________________________________________________________________________
    ================================================ FILE: pdf/Acrobat/chapter_2.xml ================================================ /
    | Chapter 2: Types
    ================================================ FILE: pdf/Acrobat/chapter_3.xml ================================================ /
    | Chapter 3: Syntax
    ================================================ FILE: pdf/Acrobat/chapter_4.xml ================================================ /
    | Chapter 4: System
    ================================================ FILE: pdf/Acrobat/chapter_5.xml ================================================ /
    | Chapter 5: Data
    ================================================ FILE: pdf/Acrobat/chapter_6.xml ================================================ /
    | Chapter 6: Advanced
    ================================================ FILE: pdf/Acrobat/chapter_7.xml ================================================ /
    | Chapter 7: Libraries
    ================================================ FILE: pdf/Acrobat/chapter_8.xml ================================================ /
    | Chapter 8: Multimedia
    ================================================ FILE: pdf/Acrobat/even_pages.xml ================================================ /
    ================================================ FILE: pdf/Acrobat/odd_pages.xml ================================================ /
    ================================================ FILE: pdf/README.md ================================================ How To Create PDF (on macOS) ============================ Setup ----- * Install Adobe Acrobat Pro DC. * Copy headers and footers from `pdf/acrobat/` folder to `/Users//Library/Preferences/Adobe/Acrobat/DC/HeaderFooter/`. Printing to PDF --------------- ### Normal PDF * Open `index.html` in text editor and first remove element `


    ` before the `

    Libraries

    `. * Then replace the index and footer with contents of `pdf/index_for_pdf.html` file and save. * Disable internet connection and open Chromium version 108.0.5328.0 (later versions will render the site incorrectly after index is added). Right click anywhere in the window and choose 'inspect'. Go to 'Network' tab and check 'Disable Cache'. Open the `index.html` file while keeping the inspect window open. * Right click on the border of the site and select inspect. Select `` element under 'Elements' tab and change top margin and top padding from 16 to 0 in 'Styles' tab. * Change brightness of comments by right clicking on one of them and selecting inspect. Then click on the rectangle that represents color and toggle the color space to HSLA by clicking on the button with two vertical arrows. Change lightness (L) percentage to 77%. * Change the brightness of text to 13%. * Select 'Print...' with destination 'Save as PDF', paper size 'A4', 'Default' margins (top 10mm, right 9.5mm, bottom 8mm and left 10mm), 'Default' scale and no headers and footers and save (the document should be 51 pages long with last page empty). * Check if plots were rendered correctly. ### PDF optimized for laser color printing * Run `./parse.js` again. * Change all links in text to normal text and add a page number in brackets like that: '(p. )' by running './pdf/remove_links.py' (Links can be found with this regex: `.*a href.*`). * Open `index.html` in text editor and first remove element `


    ` before the `

    Libraries

    `. * Then replace the index and footer with contents of `pdf/index_for_pdf_print.html` file and save. * Disable internet connection and open Chromium version 108.0.5328.0 (later versions will render the site incorrectly after index is added). Right click anywhere in the window and choose 'inspect'. Go to 'Network' tab and check 'Disable Cache'. Open the `index.html` file while keeping the inspect window open. * Right click on the border of the site and select inspect. Select `` element under 'Elements' tab and change top margin and top padding from 16 to 0 in 'Styles' tab. * Change brightness of elements by right clicking on them and selecting inspect. Then click on the rectangle that represents color and toggle the color space to HSLA by clicking on the button with two vertical arrows. * Change lightness (L) percentage to: * 0% for the text. * 87% for the gray line on the left side of the code. * 89% for the gray hash characters by the titles * 37% for the red text and function names (they use their own red). * 60% for the blue text and the text in the contents (it uses its own blue), but leave color of decorators and the `>>>` intact. * 58% for the comments. * Individually change brightness of every comment line that starts with: `# $ pip3 install` and of comments in basic script template to 57%, by adding `color: hsla(0, 0%, 57%, 1);` to their element.style. * Select 'Print...' with destination 'Save as PDF', paper size 'A4', 'Default' margins (top 10mm, right 9.5mm, bottom 8mm and left 10mm), 'Default' scale and no headers and footers and save (the document should be 51 pages long with last page empty). * Check if plots were rendered correctly. Adding headers and footers to PDF (the same for both files) ----------------------------------------------------------- * Open the PDF file in Adobe Acrobat Pro DC. * Select 'Organize Pages'. * Right click the second page and select 'Crop Pages...'. * Select units: 'Inches'. * In 'Change page size' section select 'A4' for 'Page Sizes' and set 'XOffset' to '0.1 in'. Then click on 'YOffset' input field, so the x offset gets registered. Select page range 'All' and click OK. * Select 'Edit PDF' tab and add headers and footers by clicking 'Header & Footer' button, selecting a preset from 'Saved Settings' dropdown menu and clicking ok. Popup will say that font 'Menlo' contains invalid encoding. This is fine. * Start by adding the bottom_line preset and check afterward if bottom line on the first page is aligned properly with the text. If it is not close the file and start over. * Repeat the process for each preset. When popup asks you if you want to replace existing header or footer click 'Add New'. * Use this values for font and margins if presets get lost: Borders: left-line: 0.6, left-text: 0.8, top-line: 11.4, bottom-text: 0.27, right-text-odd: 0.57, font-name: menlo, font-size: 8. * Select 'Organize Pages' tab and remove the last page (it should be empty). * Select 'File/Properties...' and set title to 'Comprehensive Python Cheatsheet' and author to 'Jure Šorn'. * Save the progress by running 'Save as' in Format: 'Adobe PDF Files'. * Run 'Save as' again, this time in 'Adobe PDF Files, Optimized', so that Menlo font error gets fixed. Compressing ----------- * Compress the two files together with HOW_TO_PRINT.txt instruction file that contains the instructions from the next section using: `zip 'Comprehensive Python Cheatsheet.zip' 'Comprehensive Python Cheatsheet.pdf' 'Comprehensive Python Cheatsheet (optimized for printing).pdf' 'HOW_TO_PRINT.txt'`. Printing the PDF ---------------- * Open the PDF that was optimized for printing in Chrome and print on A4 on both sides with default margins, scale 98% and no headers and footers. ================================================ FILE: pdf/create_index.py ================================================ #!/usr/bin/env python3 # # Usage: .py # from collections import namedtuple from dataclasses import make_dataclass from enum import Enum import re import sys from bs4 import BeautifulSoup from collections import defaultdict def main(): html = read_file('index.html') doc = BeautifulSoup(''.join(html), 'html.parser') hhh = defaultdict(lambda: defaultdict(list)) for i in range(2, 5): for h in doc.find_all(f'h{i}'): an_id = h.attrs['id'] text = h.text.lstrip('#') first_letter = text[0] hhh[first_letter][text].append(an_id) print_hhh(hhh) def print_hhh(hhh): letters = hhh.keys() for letter in sorted(letters): hh = hhh[letter] print(f'### {letter}') commands = hh.keys() for command in sorted(commands): links = hh[command] lll = ', '.join(f'[1](#{l})' for l in links) print(f'**{command} {lll}** ') print() ### ## UTIL # def read_file(filename): with open(filename, encoding='utf-8') as file: return file.readlines() if __name__ == '__main__': main() ================================================ FILE: pdf/index_for_pdf.html ================================================

    #Index

    A

    abstract base classes, 4, 19
    animation, 40, 42-43
    argparse module, 22
    arguments, 10, 12, 22
    arrays, 29, 37-38
    asyncio module, 33
    audio, 40-41, 42

    B

    beautifulsoup library, 35
    binary representation, 7, 8
    bitwise operators, 8, 30
    bytes, 22-23, 25, 28-29

    C

    cache, 13
    callable, 17
    class, 4, 14-20
    closure, 12-13
    collection, 4, 18, 19
    collections module, 2, 3, 4, 19, 29
    combinatorics, 8
    command line arguments, 22
    comprehensions, 1, 2, 11
    context manager, 17, 23, 27, 32
    copy function, 15
    coroutine, 33
    counter, 2, 4, 12, 17
    csv, 26, 34, 46, 47
    curses module, 33, 34
    cython, 15, 49

    D

    dataclasses module, 11, 15
    datetime module, 8-9
    decorator, 13, 14, 15, 16
    deques, 29
    dictionaries, 2, 4, 10-11, 19, 21
    duck types, 16-19

    E

    enum module, 19-20
    enumerate function, 3
    excel, 46
    exceptions, 20-21, 23, 31
    exit function, 21

    F

    files, 22-29, 34, 46
    filter function, 11
    flask library, 36
    floats, 4, 6, 7
    format, 6-7
    functools module, 11, 12, 13, 16

    G

    games, 33, 42-43
    generators, 4, 11, 17
    global keyword, 10, 12
    gui app, 35

    H

    hashable, 15, 16
    hexadecimal representation, 7, 8, 28

    I

    image, 35, 39-40, 42-43
    imports, 12
    inline, 11, 15, 20
    input function, 22
    introspection, 21, 31
    ints, 4, 7-8, 28
    is operator, 16, 30
    iterable, 4, 18, 19
    iterator, 3-4, 11, 17
    itertools module, 3, 8

    J

    json, 25, 36, 46

    L

    lambda, 11
    lists, 1-2, 4, 10-11, 18-19, 21
    locale module, 16
    logging, 31

    M

    main function, 1, 49
    match statement, 30
    matplotlib library, 34, 44, 45
    map function, 11, 30
    math module, 7
    memoryviews, 29
    module, 12

    N

    namedtuples, 3, 6
    nonlocal keyword, 12
    numbers, 4, 6-8
    numpy library, 37-38, 39, 44

    O

    open function, 17, 22-23, 25, 26, 28
    operator module, 30
    os commands, 23-25, 34

    P

    pandas library, 44-48
    partial function, 12, 20
    paths, 23-24, 34
    pickle module, 25
    pillow library, 39-40
    plotting, 34, 44, 45, 47-48
    print function, 14, 22
    profiling, 36-37
    progress bar, 34
    property decorator, 15, 16
    pygame library, 42-43

    Q

    queues, 29, 32, 33

    R

    random module, 8, 33, 41
    ranges, 3, 4
    recursion, 13, 21
    reduce function, 11
    regular expressions, 5-6
    requests library, 35, 36

    S

    scope, 10, 12, 20
    scraping, 35, 43, 46, 47-48
    sequence, 4, 18-19
    sets, 2, 4, 10-11, 19, 21
    shell commands, 25
    sleep function, 34
    sortable, 1, 16
    splat operator, 10, 26
    sql, 27, 46
    statistics, 7, 37-38, 44-48
    strings, 4-7, 14
    struct module, 28-29
    subprocess module, 25
    super function, 14
    sys module, 13, 21-22

    T

    table, 26, 27, 34, 37-38, 45-46
    template, 6, 36
    threading module, 32, 36
    time module, 34, 36
    tuples, 3, 4, 10-11, 18-19
    type, 4, 16, 30
    type annotations, 15, 31

    W

    wave module, 40-41
    web app, 36

    ================================================ FILE: pdf/index_for_pdf_print.html ================================================

    #Index

    A

    abstract base classes, 4, 19
    animation, 40, 42-43
    argparse module, 22
    arguments, 10, 12, 22
    arrays, 29, 37-38
    asyncio module, 33
    audio, 40-41, 42

    B

    beautifulsoup library, 35
    binary representation, 7, 8
    bitwise operators, 8, 30
    bytes, 22-23, 25, 28-29

    C

    cache, 13
    callable, 17
    class, 4, 14-20
    closure, 12-13
    collection, 4, 18, 19
    collections module, 2, 3, 4, 19, 29
    combinatorics, 8
    command line arguments, 22
    comprehensions, 1, 2, 11
    context manager, 17, 23, 27, 32
    copy function, 15
    coroutine, 33
    counter, 2, 4, 12, 17
    csv, 26, 34, 46, 47
    curses module, 33, 34
    cython, 15, 49

    D

    dataclasses module, 11, 15
    datetime module, 8-9
    decorator, 13, 14, 15, 16
    deques, 29
    dictionaries, 2, 4, 10-11, 19, 21
    duck types, 16-19

    E

    enum module, 19-20
    enumerate function, 3
    excel, 46
    exceptions, 20-21, 23, 31
    exit function, 21

    F

    files, 22-29, 34, 46
    filter function, 11
    flask library, 36
    floats, 4, 6, 7
    format, 6-7
    functools module, 11, 12, 13, 16

    G

    games, 33, 42-43
    generators, 4, 11, 17
    global keyword, 10, 12
    gui, 35

    H

    hashable, 15, 16
    hexadecimal representation, 7, 8, 28

    I

    image, 35, 39-40, 42-43
    imports, 12
    inline, 11, 15, 20
    input function, 22
    introspection, 21, 31
    ints, 4, 7-8, 28
    is operator, 16, 30
    iterable, 4, 18, 19
    iterator, 3-4, 11, 17
    itertools module, 3, 8

    J

    json, 25, 36, 46

    L

    lambda, 11
    lists, 1-2, 4, 10-11, 18-19, 21
    locale module, 16
    logging, 31

    M

    main function, 1, 49
    match statement, 30
    matplotlib library, 34, 44, 45
    map function, 11, 30
    math module, 7
    memoryviews, 29
    module, 12

    N

    namedtuples, 3, 6
    nonlocal keyword, 12
    numbers, 4, 6-8
    numpy library, 37-38, 39, 44

    O

    open function, 17, 22-23, 25, 26, 28
    operator module, 30
    os commands, 23-25, 34

    P

    pandas library, 44-48
    partial function, 12, 20
    paths, 23-24, 34
    pickle module, 25
    pillow library, 39-40
    plotting, 34, 44, 45, 47-48
    print function, 14, 22
    profiling, 36-37
    progress bar, 34
    property decorator, 15, 16
    pygame library, 42-43

    Q

    queues, 29, 32, 33

    R

    random module, 8, 33, 41
    ranges, 3, 4
    recursion, 13, 21
    reduce function, 11
    regular expressions, 5-6
    requests library, 35, 36

    S

    scope, 10, 12, 20
    scraping, 35, 43, 46, 47-48
    sequence, 4, 18-19
    sets, 2, 4, 10-11, 19, 21
    shell commands, 25
    sleep function, 34
    sortable, 1, 16
    splat operator, 10, 26
    sql, 27, 46
    statistics, 7, 37-38, 44-48
    strings, 4-7, 14
    struct module, 28-29
    subprocess module, 25
    super function, 14
    sys module, 13, 21-22

    T

    table, 26, 27, 34, 37-38, 45-46
    template, 6, 36
    threading module, 32, 36
    time module, 34, 36
    tuples, 3, 4, 10-11, 18-19
    type, 4, 16, 30
    type annotations, 15, 31

    W

    wave module, 40-41
    web, 36

    ================================================ FILE: pdf/popup.html ================================================

    “A very helpful cheat sheet, quite long.” ― Brian Kernighan
    • Footers with page numbers and chapter titles.
    • Index on the last page.
    • Carefully chosen locations of page breaks.
    • Includes a bonus PDF optimized for color laser printing.
    • Free updates via Email (~2x per year).
    • 50 pages.
    Buy Now
    ================================================ FILE: pdf/remove_links.py ================================================ #!/usr/bin/env python3 # # Usage: ./remove_links.py # Removes links from index.html and adds page numbers in brackets instead (p. XX). from pathlib import Path MATCHES = { 'For details about sort(), sorted(), min() and max() see Sortable.': 'For details about functions sort(), sorted(), max() and min() see duck type sortable (p. 16).', 'Module operator has function itemgetter() that can replace listed lambdas.': 'Listed lambda expressions can be replaced by the operator\'s itemgetter() function (p. 31).', 'This text uses the term collection instead of iterable. For rationale see duck types.': 'This text uses the term collection instead of iterable. For rationale see duck types (p. 18).', 'Calling \'iter(<iter>)\' returns unmodified iterator. For details see Iterator duck type.': 'Calling \'iter(<iter>)\' returns unmodified iterator. For details see duck types (p. 17).', 'Each abstract base class specifies a set of virtual subclasses. These classes are then recognized by isinstance() and issubclass() as subclasses of the ABC, although they are really not. An ABC can also manually decide whether or not a specific class is its virtual subclass, usually based on which methods that class has implemented. For instance, Iterable ABC looks for method iter(), while Collection ABC looks for iter(), contains() and len().': 'Each abstract base class specifies a set of virtual subclasses. These classes are then recognized by isinstance() and issubclass() as subclasses of the ABC, although they are really not. An ABC can also manually decide whether or not a specific class is its virtual subclass, usually based on which methods that class has implemented. For instance, Iterable ABC looks for method iter(), while Collection ABC looks for iter(), contains() and len().', 'Adding \'!r\' to the expression first calls result\'s repr() method and only then format().': 'Adding \'!r\' to the expression first calls result\'s repr() method and only then format().', 'Use relative imports, i.e. \'from .[…][<pkg/mod>[.…]] import <obj>\', if project has scattered entry points. Another option is to install the whole project by moving its code into \'src\' dir, adding \'pyproject.toml\' to its root, and running \'$ pip3 install -e .\'.': 'Use relative imports, i.e. \'from .[…][<pkg/mod>[.…]] import <obj>\', if project has scattered entry points. Another option is to install the whole project by moving its code into \'src\' dir, adding \'pyproject.toml\' to its root, and running \'$ pip3 install -e .\'.', 'A decorator takes a function, adds some functionality and returns it. It can be any callable, but is usually implemented as a function that returns a closure.': 'A decorator takes a function, adds some functionality and returns it. It can be any callable (p. 17), but is usually implemented as a function that returns a closure (p. 12).', 'Hints are used by type checkers like mypy, data validation libraries such as Pydantic and lately also by Cython compiler. However, they are not enforced by CPython interpreter.': 'Hints are used by type checkers like mypy, data validation libraries such as Pydantic and lately also by Cython compiler. However, they are not enforced by CPython interpreter.', 'Objects can be made sortable with \'order=True\' and immutable with \'frozen=True\'.': 'Objects can be made sortable with \'order=True\' and immutable with \'frozen=True\'.', 'For object to be hashable, all attributes must be hashable and \'frozen\' must be \'True\'.': 'For object to be hashable, all attributes must be hashable and \'frozen\' must be \'True\'.', 'Function field() is needed because \'<attr_name>: list = []\' would make a list that is shared among all instances. Its \'default_factory\' argument accepts any callable object.': 'Function field() is needed because \'<attr_name>: list = []\' would make a list that is shared among all instances. Its \'default_factory\' argument accepts any callable object.', 'Sequence iterators returned by the iter() function, such as list_iterator, etc.': 'Sequence iterators returned by the iter() function, such as list_iterator, etc.', 'Objects returned by the itertools module, such as count, repeat and cycle.': 'Objects returned by the itertools module, such as count, repeat and cycle.', 'Generators returned by the generator functions and generator expressions.': 'Generators returned by the generator functions and generator expressions.', 'File objects returned by the open() function, SQLite cursor objects, etc.': 'File objects returned by the open() function, SQLite cursor objects, etc.', 'Use \'logging.exception(<str>)\' to log the passed message, followed by the full error message of the caught exception. For details about how to set up the logger see Logging.': 'Use \'logging.exception(<str>)\' to log the passed message, followed by the full error message of the caught exception. For details about the logger setup see Logging (p. 31).', '\'rb\' - Reads bytes objects. Also \'wb\', \'xb\', etc.': '\'rb\' - Reads bytes (p. 28). Also \'wb\', \'xb\', etc.', 'Passed paths can be either strings, Path objects, or DirEntry objects.': 'Provided paths can be either strings, Path objects, or DirEntry objects.', 'Functions report errors by raising OSError or one of its subclasses.': 'Functions report errors by raising OSError or one of its subclasses (p. 23).', 'Without the \'newline=""\' argument, every \'\\r\\n\' sequence that is embedded inside a quoted field will get converted to \'\\n\'. For details about the newline argument see Open.': 'Without the \'newline=""\' argument, every \'\\r\\n\' sequence that is embedded inside a quoted field will get converted to \'\\n\'. For details about the newline arg. see Open (p. 22).', 'To nicely print the spreadsheet to the console use either Tabulate or PrettyTable library.': 'To print the spreadsheet to the console use either Tabulate or PrettyTable library (p. 34).', 'For XML and binary Excel files (with extensions xlsx, xlsm and xlsb) use Pandas library.': 'For XML and binary Excel files (extensions xlsx, xlsm and xlsb) use Pandas library (p. 46).', 'Library for interacting with various DB systems via SQL, method chaining or ORM.': 'Library for interacting with various DB systems via SQL, method chaining, or ORM.', 'ProcessPoolExecutor provides true parallelism but: everything sent to and from workers must be pickable, queues must be sent using executor\'s \'initargs\' and \'initializer\' param­eters, and executor should only be reachable via \'if __name__ == "__main__": …\'.': 'ProcessPoolExecutor provides true parallelism but: everything sent to and from workers must be pickable, queues must be sent using executor\'s \'initargs\' and \'initializer\' param­eters, and executor should only be reachable via \'if __name__ == "__main__": …\'.', 'Install a WSGI server like Waitress and a HTTP server such as Nginx to get better security.': 'Install a WSGI server like Waitress and a HTTP server such as Nginx to get better security.', 'Data analysis library. For examples see Plotly.': 'Data analysis library. For examples see Plotly (p. 47).', } def main(): index_path = Path('..', 'index.html') lines = read_file(index_path) out = ''.join(lines) for from_, to_ in MATCHES.items(): out = out.replace(from_, to_, 1) write_to_file(index_path, out) ### ## UTIL # def read_file(filename): p = Path(__file__).resolve().parent / filename with open(p, encoding='utf-8') as file: return file.readlines() def write_to_file(filename, text): p = Path(__file__).resolve().parent / filename with open(p, 'w', encoding='utf-8') as file: file.write(text) if __name__ == '__main__': main() ================================================ FILE: web/OnlineWebFonts_COM_cb7eb796ae7de7195a34c485cacebad1/@font-face/Demo.html ================================================ Menlo Regular Font - OnlineWebFonts.COM

    OnlineWebFonts Font Demo

    Menlo Regular Font More Format Downloads

    Instructions:
    • 1Use font-face declaration Fonts.

      @font-face {font-family: "Menlo Regular";
        src: url("9f94dc20bb2a09c15241d3a880b7ad01.eot"); /* IE9*/
        src: url("9f94dc20bb2a09c15241d3a880b7ad01.eot?#iefix") format("embedded-opentype"), /* IE6-IE8 */
        url("9f94dc20bb2a09c15241d3a880b7ad01.woff2") format("woff2"), /* chrome、firefox */
        url("9f94dc20bb2a09c15241d3a880b7ad01.woff") format("woff"), /* chrome、firefox */
        url("9f94dc20bb2a09c15241d3a880b7ad01.ttf") format("truetype"), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/
        url("9f94dc20bb2a09c15241d3a880b7ad01.svg#Menlo Regular") format("svg"); /* iOS 4.1- */
      }
      
    • 2Settings font css style

      .demo{
          font-family:"Menlo Regular" !important;
          font-size:16px;font-style:normal;
          -webkit-font-smoothing: antialiased;
          -webkit-text-stroke-width: 0.2px;
          -moz-osx-font-smoothing: grayscale;}
      
    • 3View DEMO

      <div class="demo"> www.OnlineWebFonts.Com </div>
      
    • OROr add to the head section of page.

      <link href="//db.onlinewebfonts.com/c/9f94dc20bb2a09c15241d3a880b7ad01?family=Menlo+Regular" rel="stylesheet" type="text/css"/>
      
    
    OnlineWebFonts.Com features an amazing collection of free fonts,
    premium fonts and free dingbats. With over 8,000,000 freeware fonts, 
    you've come to the best place to download fonts! 
    
    OnlineWebFonts.Com Some fonts provided are trial versions of full versions and may not allow embedding 
    unless a commercial license is purchased or may contain a limited character set. 
    Please review any files included with your download, 
    which will usually include information on the usage and licenses of the fonts. 
    If no information is provided, 
    please use at your own discretion or contact the author directly. 
    
    0123456789  /*-+~!@#$%^&*()-=_+{}[]:;"'|\<>.?
    
    
    License and attribution:
    You must credit the author Copy this link ( oNlineWebFonts.Com ) on your web
    Copy the Attribution License:
    ================================================ FILE: web/OnlineWebFonts_COM_cb7eb796ae7de7195a34c485cacebad1/License.txt ================================================ X------------------------------------------------------[ FREE FONT : http://www.OnlineWebFonts.Com ^------------------------------------------------------a You must credit the author Copy this link on your web
    Font made from oNline Web Fonts is licensed by CC BY 3.0
    OR oNline Web Fonts ======================================================================================================= OnlineWebFonts.Com features an amazing collection of free fonts, premium fonts and free dingbats. With over 8,000,000 freeware fonts, you've come to the best place to download fonts! ======================================================================================================= OnlineWebFonts.Com Some fonts provided are trial versions of full versions and may not allow embedding unless a commercial license is purchased or may contain a limited character set. Please review any files included with your download, which will usually include information on the usage and licenses of the fonts. If no information is provided, please use at your own discretion or contact the author directly. ======================================================================================================= ================================================ FILE: web/OnlineWebFonts_COM_cb7eb796ae7de7195a34c485cacebad1/Online_Web_Fonts.url ================================================ [{000214A0-0000-0000-C000-000000000046}] Prop3=19,2 [InternetShortcut] URL=http://www.onlinewebfonts.com/ IDList= IconFile=http://www.fontfree.org/favicon.ico IconIndex=1 HotKey=0 ================================================ FILE: web/OnlineWebFonts_COM_d6ba633f6ea4cafe1a39ab736fe55e88/License.txt ================================================ X------------------------------------------------------[ FREE FONT : http://www.OnlineWebFonts.Com ^------------------------------------------------------a You must credit the author Copy this link on your web
    Font made from oNline Web Fonts is licensed by CC BY 3.0
    OR oNline Web Fonts ======================================================================================================= OnlineWebFonts.Com features an amazing collection of free fonts, premium fonts and free dingbats. With over 8,000,000 freeware fonts, you've come to the best place to download fonts! ======================================================================================================= OnlineWebFonts.Com Some fonts provided are trial versions of full versions and may not allow embedding unless a commercial license is purchased or may contain a limited character set. Please review any files included with your download, which will usually include information on the usage and licenses of the fonts. If no information is provided, please use at your own discretion or contact the author directly. ======================================================================================================= ================================================ FILE: web/OnlineWebFonts_COM_d6ba633f6ea4cafe1a39ab736fe55e88/Menlo Bold/@font-face/Demo.html ================================================ Menlo Bold Font - OnlineWebFonts.COM

    OnlineWebFonts Fonts Demo

    Menlo Bold Fonts More Formats Downloads

    Instructions:
    • 1Use font-face declaration Fonts.

      @font-face {font-family: "Menlo Bold";
        src: url("a6ffc5d72a96b65159e710ea6d258ba4.eot"); /* IE9*/
        src: url("a6ffc5d72a96b65159e710ea6d258ba4.eot?#iefix") format("embedded-opentype"), /* IE6-IE8 */
        url("a6ffc5d72a96b65159e710ea6d258ba4.woff2") format("woff2"), /* chrome、firefox */
        url("a6ffc5d72a96b65159e710ea6d258ba4.woff") format("woff"), /* chrome、firefox */
        url("a6ffc5d72a96b65159e710ea6d258ba4.ttf") format("truetype"), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/
        url("a6ffc5d72a96b65159e710ea6d258ba4.svg#Menlo Bold") format("svg"); /* iOS 4.1- */
      }
      
    • 2Settings font css style

      .demo{
          font-family:"Menlo Bold" !important;
          font-size:16px;font-style:normal;
          -webkit-font-smoothing: antialiased;
          -webkit-text-stroke-width: 0.2px;
          -moz-osx-font-smoothing: grayscale;}
      
    • 3View DEMO

      <div class="demo"> www.OnlineWebFonts.Com </div>
      
    • OROr add to the head section of page.

      <link href="//db.onlinewebfonts.com/c/a6ffc5d72a96b65159e710ea6d258ba4?family=Menlo+Bold" rel="stylesheet" type="text/css"/>
      
    
    OnlineWebFonts.Com features an amazing collection of free fonts,
    premium fonts and free dingbats. With over 8,000,000 freeware fonts, 
    you\'ve come to the best place to download fonts! 
    
    OnlineWebFonts.Com Some fonts provided are trial versions of full versions and may not allow embedding 
    unless a commercial license is purchased or may contain a limited character set. 
    Please review any files included with your download, 
    which will usually include information on the usage and licenses of the fonts. 
    If no information is provided, 
    please use at your own discretion or contact the author directly. 
    
    0123456789  /*-+~!@#$%^&*()-=_+{}[]:;"\'|\<>.?
    
    
    License and attribution:
    You must credit the author Copy this link ( oNlineWebFonts.Com ) on your web
    Copy the Attribution License:
    ================================================ FILE: web/OnlineWebFonts_COM_d6ba633f6ea4cafe1a39ab736fe55e88/Online_Web_Fonts.url ================================================ [{000214A0-0000-0000-C000-000000000046}] Prop3=19,2 [InternetShortcut] URL=http://www.onlinewebfonts.com/ IDList= IconFile=http://www.fontfree.org/favicon.ico IconIndex=1 HotKey=0 ================================================ FILE: web/continents.csv ================================================ Continent_Name,Continent_Code,Country_Name,Two_Letter_Country_Code,Three_Letter_Country_Code,Country_Number Asia,AS,"Afghanistan, Islamic Republic of",AF,AFG,4 Europe,EU,"Albania, Republic of",AL,ALB,8 Antarctica,AN,Antarctica (the territory South of 60 deg S),AQ,ATA,10 Africa,AF,"Algeria, People's Democratic Republic of",DZ,DZA,12 Oceania,OC,American Samoa,AS,ASM,16 Europe,EU,"Andorra, Principality of",AD,AND,20 Africa,AF,"Angola, Republic of",AO,AGO,24 North America,NA,Antigua and Barbuda,AG,ATG,28 Europe,EU,"Azerbaijan, Republic of",AZ,AZE,31 Asia,AS,"Azerbaijan, Republic of",AZ,AZE,31 South America,SA,"Argentina, Argentine Republic",AR,ARG,32 Oceania,OC,"Australia, Commonwealth of",AU,AUS,36 Europe,EU,"Austria, Republic of",AT,AUT,40 North America,NA,"Bahamas, Commonwealth of the",BS,BHS,44 Asia,AS,"Bahrain, Kingdom of",BH,BHR,48 Asia,AS,"Bangladesh, People's Republic of",BD,BGD,50 Europe,EU,"Armenia, Republic of",AM,ARM,51 Asia,AS,"Armenia, Republic of",AM,ARM,51 North America,NA,Barbados,BB,BRB,52 Europe,EU,"Belgium, Kingdom of",BE,BEL,56 North America,NA,Bermuda,BM,BMU,60 Asia,AS,"Bhutan, Kingdom of",BT,BTN,64 South America,SA,"Bolivia, Republic of",BO,BOL,68 Europe,EU,Bosnia and Herzegovina,BA,BIH,70 Africa,AF,"Botswana, Republic of",BW,BWA,72 Antarctica,AN,Bouvet Island (Bouvetoya),BV,BVT,74 South America,SA,"Brazil, Federative Republic of",BR,BRA,76 North America,NA,Belize,BZ,BLZ,84 Asia,AS,British Indian Ocean Territory (Chagos Archipelago),IO,IOT,86 Oceania,OC,Solomon Islands,SB,SLB,90 North America,NA,British Virgin Islands,VG,VGB,92 Asia,AS,Brunei Darussalam,BN,BRN,96 Europe,EU,"Bulgaria, Republic of",BG,BGR,100 Asia,AS,"Myanmar, Union of",MM,MMR,104 Africa,AF,"Burundi, Republic of",BI,BDI,108 Europe,EU,"Belarus, Republic of",BY,BLR,112 Asia,AS,"Cambodia, Kingdom of",KH,KHM,116 Africa,AF,"Cameroon, Republic of",CM,CMR,120 North America,NA,Canada,CA,CAN,124 Africa,AF,"Cape Verde, Republic of",CV,CPV,132 North America,NA,Cayman Islands,KY,CYM,136 Africa,AF,Central African Republic,CF,CAF,140 Asia,AS,"Sri Lanka, Democratic Socialist Republic of",LK,LKA,144 Africa,AF,"Chad, Republic of",TD,TCD,148 South America,SA,"Chile, Republic of",CL,CHL,152 Asia,AS,"China, People's Republic of",CN,CHN,156 Asia,AS,Taiwan,TW,TWN,158 Asia,AS,Christmas Island,CX,CXR,162 Asia,AS,Cocos (Keeling) Islands,CC,CCK,166 South America,SA,"Colombia, Republic of",CO,COL,170 Africa,AF,"Comoros, Union of the",KM,COM,174 Africa,AF,Mayotte,YT,MYT,175 Africa,AF,"Congo, Republic of the",CG,COG,178 Africa,AF,"Congo, Democratic Republic of the",CD,COD,180 Oceania,OC,Cook Islands,CK,COK,184 North America,NA,"Costa Rica, Republic of",CR,CRI,188 Europe,EU,"Croatia, Republic of",HR,HRV,191 North America,NA,"Cuba, Republic of",CU,CUB,192 Europe,EU,"Cyprus, Republic of",CY,CYP,196 Asia,AS,"Cyprus, Republic of",CY,CYP,196 Europe,EU,Czech Republic,CZ,CZE,203 Africa,AF,"Benin, Republic of",BJ,BEN,204 Europe,EU,"Denmark, Kingdom of",DK,DNK,208 North America,NA,"Dominica, Commonwealth of",DM,DMA,212 North America,NA,Dominican Republic,DO,DOM,214 South America,SA,"Ecuador, Republic of",EC,ECU,218 North America,NA,"El Salvador, Republic of",SV,SLV,222 Africa,AF,"Equatorial Guinea, Republic of",GQ,GNQ,226 Africa,AF,"Ethiopia, Federal Democratic Republic of",ET,ETH,231 Africa,AF,"Eritrea, State of",ER,ERI,232 Europe,EU,"Estonia, Republic of",EE,EST,233 Europe,EU,Faroe Islands,FO,FRO,234 South America,SA,Falkland Islands (Malvinas),FK,FLK,238 Antarctica,AN,South Georgia and the South Sandwich Islands,GS,SGS,239 Oceania,OC,"Fiji, Republic of the Fiji Islands",FJ,FJI,242 Europe,EU,"Finland, Republic of",FI,FIN,246 Europe,EU,Åland Islands,AX,ALA,248 Europe,EU,"France, French Republic",FR,FRA,250 South America,SA,French Guiana,GF,GUF,254 Oceania,OC,French Polynesia,PF,PYF,258 Antarctica,AN,French Southern Territories,TF,ATF,260 Africa,AF,"Djibouti, Republic of",DJ,DJI,262 Africa,AF,"Gabon, Gabonese Republic",GA,GAB,266 Europe,EU,Georgia,GE,GEO,268 Asia,AS,Georgia,GE,GEO,268 Africa,AF,"Gambia, Republic of the",GM,GMB,270 Asia,AS,"Palestinian Territory, Occupied",PS,PSE,275 Europe,EU,"Germany, Federal Republic of",DE,DEU,276 Africa,AF,"Ghana, Republic of",GH,GHA,288 Europe,EU,Gibraltar,GI,GIB,292 Oceania,OC,"Kiribati, Republic of",KI,KIR,296 Europe,EU,"Greece, Hellenic Republic",GR,GRC,300 North America,NA,Greenland,GL,GRL,304 North America,NA,Grenada,GD,GRD,308 North America,NA,Guadeloupe,GP,GLP,312 Oceania,OC,Guam,GU,GUM,316 North America,NA,"Guatemala, Republic of",GT,GTM,320 Africa,AF,"Guinea, Republic of",GN,GIN,324 South America,SA,"Guyana, Co-operative Republic of",GY,GUY,328 North America,NA,"Haiti, Republic of",HT,HTI,332 Antarctica,AN,Heard Island and McDonald Islands,HM,HMD,334 Europe,EU,Holy See (Vatican City State),VA,VAT,336 North America,NA,"Honduras, Republic of",HN,HND,340 Asia,AS,"Hong Kong, Special Administrative Region of China",HK,HKG,344 Europe,EU,"Hungary, Republic of",HU,HUN,348 Europe,EU,"Iceland, Republic of",IS,ISL,352 Asia,AS,"India, Republic of",IN,IND,356 Asia,AS,"Indonesia, Republic of",ID,IDN,360 Asia,AS,"Iran, Islamic Republic of",IR,IRN,364 Asia,AS,"Iraq, Republic of",IQ,IRQ,368 Europe,EU,Ireland,IE,IRL,372 Asia,AS,"Israel, State of",IL,ISR,376 Europe,EU,"Italy, Italian Republic",IT,ITA,380 Africa,AF,"Cote d'Ivoire, Republic of",CI,CIV,384 North America,NA,Jamaica,JM,JAM,388 Asia,AS,Japan,JP,JPN,392 Europe,EU,"Kazakhstan, Republic of",KZ,KAZ,398 Asia,AS,"Kazakhstan, Republic of",KZ,KAZ,398 Asia,AS,"Jordan, Hashemite Kingdom of",JO,JOR,400 Africa,AF,"Kenya, Republic of",KE,KEN,404 Asia,AS,"Korea, Democratic People's Republic of",KP,PRK,408 Asia,AS,"Korea, Republic of",KR,KOR,410 Asia,AS,"Kuwait, State of",KW,KWT,414 Asia,AS,Kyrgyz Republic,KG,KGZ,417 Asia,AS,Lao People's Democratic Republic,LA,LAO,418 Asia,AS,"Lebanon, Lebanese Republic",LB,LBN,422 Africa,AF,"Lesotho, Kingdom of",LS,LSO,426 Europe,EU,"Latvia, Republic of",LV,LVA,428 Africa,AF,"Liberia, Republic of",LR,LBR,430 Africa,AF,Libyan Arab Jamahiriya,LY,LBY,434 Europe,EU,"Liechtenstein, Principality of",LI,LIE,438 Europe,EU,"Lithuania, Republic of",LT,LTU,440 Europe,EU,"Luxembourg, Grand Duchy of",LU,LUX,442 Asia,AS,"Macao, Special Administrative Region of China",MO,MAC,446 Africa,AF,"Madagascar, Republic of",MG,MDG,450 Africa,AF,"Malawi, Republic of",MW,MWI,454 Asia,AS,Malaysia,MY,MYS,458 Asia,AS,"Maldives, Republic of",MV,MDV,462 Africa,AF,"Mali, Republic of",ML,MLI,466 Europe,EU,"Malta, Republic of",MT,MLT,470 North America,NA,Martinique,MQ,MTQ,474 Africa,AF,"Mauritania, Islamic Republic of",MR,MRT,478 Africa,AF,"Mauritius, Republic of",MU,MUS,480 North America,NA,"Mexico, United Mexican States",MX,MEX,484 Europe,EU,"Monaco, Principality of",MC,MCO,492 Asia,AS,Mongolia,MN,MNG,496 Europe,EU,"Moldova, Republic of",MD,MDA,498 Europe,EU,"Montenegro, Republic of",ME,MNE,499 North America,NA,Montserrat,MS,MSR,500 Africa,AF,"Morocco, Kingdom of",MA,MAR,504 Africa,AF,"Mozambique, Republic of",MZ,MOZ,508 Asia,AS,"Oman, Sultanate of",OM,OMN,512 Africa,AF,"Namibia, Republic of",NA,NAM,516 Oceania,OC,"Nauru, Republic of",NR,NRU,520 Asia,AS,"Nepal, State of",NP,NPL,524 Europe,EU,"Netherlands, Kingdom of the",NL,NLD,528 North America,NA,Netherlands Antilles,AN,ANT,530 North America,NA,Curaçao,CW,CUW,531 North America,NA,Aruba,AW,ABW,533 North America,NA,Sint Maarten (Netherlands),SX,SXM,534 North America,NA,"Bonaire, Sint Eustatius and Saba",BQ,BES,535 Oceania,OC,New Caledonia,NC,NCL,540 Oceania,OC,"Vanuatu, Republic of",VU,VUT,548 Oceania,OC,New Zealand,NZ,NZL,554 North America,NA,"Nicaragua, Republic of",NI,NIC,558 Africa,AF,"Niger, Republic of",NE,NER,562 Africa,AF,"Nigeria, Federal Republic of",NG,NGA,566 Oceania,OC,Niue,NU,NIU,570 Oceania,OC,Norfolk Island,NF,NFK,574 Europe,EU,"Norway, Kingdom of",NO,NOR,578 Oceania,OC,"Northern Mariana Islands, Commonwealth of the",MP,MNP,580 Oceania,OC,United States Minor Outlying Islands,UM,UMI,581 North America,NA,United States Minor Outlying Islands,UM,UMI,581 Oceania,OC,"Micronesia, Federated States of",FM,FSM,583 Oceania,OC,"Marshall Islands, Republic of the",MH,MHL,584 Oceania,OC,"Palau, Republic of",PW,PLW,585 Asia,AS,"Pakistan, Islamic Republic of",PK,PAK,586 North America,NA,"Panama, Republic of",PA,PAN,591 Oceania,OC,"Papua New Guinea, Independent State of",PG,PNG,598 South America,SA,"Paraguay, Republic of",PY,PRY,600 South America,SA,"Peru, Republic of",PE,PER,604 Asia,AS,"Philippines, Republic of the",PH,PHL,608 Oceania,OC,Pitcairn Islands,PN,PCN,612 Europe,EU,"Poland, Republic of",PL,POL,616 Europe,EU,"Portugal, Portuguese Republic",PT,PRT,620 Africa,AF,"Guinea-Bissau, Republic of",GW,GNB,624 Asia,AS,"Timor-Leste, Democratic Republic of",TL,TLS,626 North America,NA,"Puerto Rico, Commonwealth of",PR,PRI,630 Asia,AS,"Qatar, State of",QA,QAT,634 Africa,AF,Reunion,RE,REU,638 Europe,EU,Romania,RO,ROU,642 Europe,EU,Russian Federation,RU,RUS,643 Asia,AS,Russian Federation,RU,RUS,643 Africa,AF,"Rwanda, Republic of",RW,RWA,646 North America,NA,Saint Barthelemy,BL,BLM,652 Africa,AF,Saint Helena,SH,SHN,654 North America,NA,"Saint Kitts and Nevis, Federation of",KN,KNA,659 North America,NA,Anguilla,AI,AIA,660 North America,NA,Saint Lucia,LC,LCA,662 North America,NA,Saint Martin,MF,MAF,663 North America,NA,Saint Pierre and Miquelon,PM,SPM,666 North America,NA,Saint Vincent and the Grenadines,VC,VCT,670 Europe,EU,"San Marino, Republic of",SM,SMR,674 Africa,AF,"Sao Tome and Principe, Democratic Republic of",ST,STP,678 Asia,AS,"Saudi Arabia, Kingdom of",SA,SAU,682 Africa,AF,"Senegal, Republic of",SN,SEN,686 Europe,EU,"Serbia, Republic of",RS,SRB,688 Africa,AF,"Seychelles, Republic of",SC,SYC,690 Africa,AF,"Sierra Leone, Republic of",SL,SLE,694 Asia,AS,"Singapore, Republic of",SG,SGP,702 Europe,EU,Slovakia (Slovak Republic),SK,SVK,703 Asia,AS,"Vietnam, Socialist Republic of",VN,VNM,704 Europe,EU,"Slovenia, Republic of",SI,SVN,705 Africa,AF,"Somalia, Somali Republic",SO,SOM,706 Africa,AF,"South Africa, Republic of",ZA,ZAF,710 Africa,AF,"Zimbabwe, Republic of",ZW,ZWE,716 Europe,EU,"Spain, Kingdom of",ES,ESP,724 Africa,AF,South Sudan,SS,SSD,728 Africa,AF,Western Sahara,EH,ESH,732 Africa,AF,"Sudan, Republic of",SD,SDN,736 South America,SA,"Suriname, Republic of",SR,SUR,740 Europe,EU,Svalbard & Jan Mayen Islands,SJ,SJM,744 Africa,AF,"Swaziland, Kingdom of",SZ,SWZ,748 Europe,EU,"Sweden, Kingdom of",SE,SWE,752 Europe,EU,"Switzerland, Swiss Confederation",CH,CHE,756 Asia,AS,Syrian Arab Republic,SY,SYR,760 Asia,AS,"Tajikistan, Republic of",TJ,TJK,762 Asia,AS,"Thailand, Kingdom of",TH,THA,764 Africa,AF,"Togo, Togolese Republic",TG,TGO,768 Oceania,OC,Tokelau,TK,TKL,772 Oceania,OC,"Tonga, Kingdom of",TO,TON,776 North America,NA,"Trinidad and Tobago, Republic of",TT,TTO,780 Asia,AS,United Arab Emirates,AE,ARE,784 Africa,AF,"Tunisia, Tunisian Republic",TN,TUN,788 Europe,EU,"Turkey, Republic of",TR,TUR,792 Asia,AS,"Turkey, Republic of",TR,TUR,792 Asia,AS,Turkmenistan,TM,TKM,795 North America,NA,Turks and Caicos Islands,TC,TCA,796 Oceania,OC,Tuvalu,TV,TUV,798 Africa,AF,"Uganda, Republic of",UG,UGA,800 Europe,EU,Ukraine,UA,UKR,804 Europe,EU,"Macedonia, The Former Yugoslav Republic of",MK,MKD,807 Africa,AF,"Egypt, Arab Republic of",EG,EGY,818 Europe,EU,United Kingdom of Great Britain & Northern Ireland,GB,GBR,826 Europe,EU,"Guernsey, Bailiwick of",GG,GGY,831 Europe,EU,"Jersey, Bailiwick of",JE,JEY,832 Europe,EU,Isle of Man,IM,IMN,833 Africa,AF,"Tanzania, United Republic of",TZ,TZA,834 North America,NA,United States of America,US,USA,840 North America,NA,United States Virgin Islands,VI,VIR,850 Africa,AF,Burkina Faso,BF,BFA,854 South America,SA,"Uruguay, Eastern Republic of",UY,URY,858 Asia,AS,"Uzbekistan, Republic of",UZ,UZB,860 South America,SA,"Venezuela, Bolivarian Republic of",VE,VEN,862 Oceania,OC,Wallis and Futuna,WF,WLF,876 Oceania,OC,"Samoa, Independent State of",WS,WSM,882 Asia,AS,Yemen,YE,YEM,887 Africa,AF,"Zambia, Republic of",ZM,ZMB,894 Oceania,OC,Disputed Territory,XX,, Asia,AS,Iraq-Saudi Arabia Neutral Zone,XE,, Asia,AS,United Nations Neutral Zone,XD,, Asia,AS,Spratly Islands,XS,, ================================================ FILE: web/convert_table.py ================================================ #!/usr/bin/env python3 def convert_table(lines): def from_ascii(): out = [] first, header, third, *body, last = lines first = first.translate(str.maketrans({'-': '━', '+': '┯'})) out.append(f'┏{first[1:-1]}┓') header = header.translate(str.maketrans({'|': '│'})) out.append(f'┃{header[1:-1]}┃') third = third.translate(str.maketrans({'-': '─', '+': '┼'})) out.append(f'┠{third[1:-1]}┨') for line in body: line = line.translate(str.maketrans({'|': '│'})) line = line.replace('yes', ' ✓ ') out.append(f'┃{line[1:-1]}┃') last = last.translate(str.maketrans({'-': '━', '+': '┷'})) out.append(f'┗{last[1:-1]}┛') return '\n'.join(out) def from_unicode(): out = [] for line in lines: line = line.translate(str.maketrans('┏┓┗┛┠┼┨┯┷━─┃│', '+++++++++--||')) line = line.replace(' ✓ ', 'yes') out.append(line) return '\n'.join(out) if lines[0][0] == '+': return from_ascii() return from_unicode() if __name__ == '__main__': input_lines = [] try: while True: input_lines.append(input()) except EOFError: pass print(convert_table(input_lines)) ================================================ FILE: web/covid_cases.js ================================================ window.PLOTLYENV=window.PLOTLYENV || {}; if (document.getElementById("e23ccacc-a456-478b-b467-7282a2165921")) { Plotly.newPlot( 'e23ccacc-a456-478b-b467-7282a2165921', { "data": [ { "line": { "color": "#EF553B" }, "name": "Total Cases", "x": [ "2020-02-23", "2020-02-24", "2020-02-25", "2020-02-26", "2020-02-27", "2020-02-28", "2020-02-29", "2020-03-01", "2020-03-02", "2020-03-03", "2020-03-04", "2020-03-05", "2020-03-06", "2020-03-07", "2020-03-08", "2020-03-09", "2020-03-10", "2020-03-11", "2020-03-12", "2020-03-13", "2020-03-14", "2020-03-15", "2020-03-16", "2020-03-17", "2020-03-18", "2020-03-19", "2020-03-20", "2020-03-21", "2020-03-22", "2020-03-23", "2020-03-24", "2020-03-25", "2020-03-26", "2020-03-27", "2020-03-28", "2020-03-29", "2020-03-30", "2020-03-31", "2020-04-01", "2020-04-02", "2020-04-03", "2020-04-04", "2020-04-05", "2020-04-06", "2020-04-07", "2020-04-08", "2020-04-09", "2020-04-10", "2020-04-11", "2020-04-12", "2020-04-13", "2020-04-14", "2020-04-15", "2020-04-16", "2020-04-17", "2020-04-18", "2020-04-19", "2020-04-20", "2020-04-21", "2020-04-22", "2020-04-23", "2020-04-24", "2020-04-25", "2020-04-26", "2020-04-27", "2020-04-28", "2020-04-29", "2020-04-30", "2020-05-01", "2020-05-02", "2020-05-03", "2020-05-04", "2020-05-05", "2020-05-06", "2020-05-07", "2020-05-08", "2020-05-09", "2020-05-10", "2020-05-11", "2020-05-12", "2020-05-13", "2020-05-14", "2020-05-15", "2020-05-16", "2020-05-17", "2020-05-18", "2020-05-19", "2020-05-20", "2020-05-21", "2020-05-22", "2020-05-23", "2020-05-24", "2020-05-25", "2020-05-26", "2020-05-27", "2020-05-28", "2020-05-29", "2020-05-30", "2020-05-31", "2020-06-01", "2020-06-02", "2020-06-03", "2020-06-04", "2020-06-05", "2020-06-06", "2020-06-07", "2020-06-08", "2020-06-09", "2020-06-10", "2020-06-11", "2020-06-12", "2020-06-13", "2020-06-14", "2020-06-15", "2020-06-16", "2020-06-17", "2020-06-18", "2020-06-19", "2020-06-20", "2020-06-21", "2020-06-22", "2020-06-23", "2020-06-24", "2020-06-25", "2020-06-26", "2020-06-27", "2020-06-28", "2020-06-29", "2020-06-30", "2020-07-01", "2020-07-02", "2020-07-03", "2020-07-04", "2020-07-05", "2020-07-06", "2020-07-07", "2020-07-08", "2020-07-09", "2020-07-10", "2020-07-11", "2020-07-12", "2020-07-13", "2020-07-14", "2020-07-15", "2020-07-16", "2020-07-17", "2020-07-18", "2020-07-19", "2020-07-20", "2020-07-21", "2020-07-22", "2020-07-23", "2020-07-24", "2020-07-25", "2020-07-26", "2020-07-27", "2020-07-28", "2020-07-29", "2020-07-30", "2020-07-31", "2020-08-01", "2020-08-02", "2020-08-03", "2020-08-04", "2020-08-05", "2020-08-06", "2020-08-07", "2020-08-08", "2020-08-09", "2020-08-10", "2020-08-11", "2020-08-12", "2020-08-13", "2020-08-14", "2020-08-15", "2020-08-16", "2020-08-17", "2020-08-18", "2020-08-19", "2020-08-20", "2020-08-21", "2020-08-22", "2020-08-23", "2020-08-24", "2020-08-25", "2020-08-26", "2020-08-27", "2020-08-28", "2020-08-29", "2020-08-30", "2020-08-31", "2020-09-01", "2020-09-02", "2020-09-03", "2020-09-04", "2020-09-05", "2020-09-06", "2020-09-07", "2020-09-08", "2020-09-09", "2020-09-10", "2020-09-11", "2020-09-12", "2020-09-13", "2020-09-14", "2020-09-15", "2020-09-16", "2020-09-17", "2020-09-18", "2020-09-19", "2020-09-20", "2020-09-21", "2020-09-22", "2020-09-23", "2020-09-24", "2020-09-25", "2020-09-26", "2020-09-27", "2020-09-28", "2020-09-29", "2020-09-30", "2020-10-01", "2020-10-02", "2020-10-03", "2020-10-04", "2020-10-05", "2020-10-06", "2020-10-07", "2020-10-08", "2020-10-09", "2020-10-10", "2020-10-11", "2020-10-12", "2020-10-13", "2020-10-14", "2020-10-15", "2020-10-16", "2020-10-17", "2020-10-18", "2020-10-19", "2020-10-20", "2020-10-21", "2020-10-22", "2020-10-23", "2020-10-24", "2020-10-25", "2020-10-26", "2020-10-27", "2020-10-28", "2020-10-29", "2020-10-30", "2020-10-31", "2020-11-01", "2020-11-02", "2020-11-03", "2020-11-04", "2020-11-05", "2020-11-06", "2020-11-07", "2020-11-08", "2020-11-09", "2020-11-10", "2020-11-11", "2020-11-12", "2020-11-13", "2020-11-14", "2020-11-15", "2020-11-16", "2020-11-17", "2020-11-18", "2020-11-19", "2020-11-20", "2020-11-21", "2020-11-22", "2020-11-23", "2020-11-24", "2020-11-25", "2020-11-26", "2020-11-27", "2020-11-28", "2020-11-29", "2020-11-30", "2020-12-01", "2020-12-02", "2020-12-03", "2020-12-04", "2020-12-05", "2020-12-06", "2020-12-07", "2020-12-08", "2020-12-09", "2020-12-10", "2020-12-11", "2020-12-12", "2020-12-13", "2020-12-14", "2020-12-15", "2020-12-16", "2020-12-17", "2020-12-18", "2020-12-19", "2020-12-20", "2020-12-21", "2020-12-22", "2020-12-23", "2020-12-24", "2020-12-25", "2020-12-26", "2020-12-27", "2020-12-28", "2020-12-29", "2020-12-30", "2020-12-31", "2021-01-01", "2021-01-02", "2021-01-03", "2021-01-04", "2021-01-05", "2021-01-06", "2021-01-07", "2021-01-08", "2021-01-09", "2021-01-10", "2021-01-11", "2021-01-12", "2021-01-13", "2021-01-14", "2021-01-15", "2021-01-16", "2021-01-17", "2021-01-18", "2021-01-19", "2021-01-20", "2021-01-21", "2021-01-22", "2021-01-23", "2021-01-24", "2021-01-25", "2021-01-26", "2021-01-27", "2021-01-28", "2021-01-29", "2021-01-30", "2021-01-31", "2021-02-01", "2021-02-02", "2021-02-03", "2021-02-04", "2021-02-05", "2021-02-06", "2021-02-07", "2021-02-08", "2021-02-09", "2021-02-10", "2021-02-11", "2021-02-12", "2021-02-13", "2021-02-14", "2021-02-15", "2021-02-16", "2021-02-17", "2021-02-18", "2021-02-19", "2021-02-20", "2021-02-21", "2021-02-22", "2021-02-23", "2021-02-24", "2021-02-25", "2021-02-26", "2021-02-27", "2021-02-28", "2021-03-01", "2021-03-02", "2021-03-03", "2021-03-04", "2021-03-05", "2021-03-06", "2021-03-07", "2021-03-08", "2021-03-09", "2021-03-10", "2021-03-11", "2021-03-12", "2021-03-13", "2021-03-14", "2021-03-15", "2021-03-16", "2021-03-17", "2021-03-18", "2021-03-19", "2021-03-20", "2021-03-21", "2021-03-22", "2021-03-23", "2021-03-24", "2021-03-25", "2021-03-26", "2021-03-27", "2021-03-28", "2021-03-29", "2021-03-30", "2021-03-31", "2021-04-01", "2021-04-02", "2021-04-03", "2021-04-04", "2021-04-05", "2021-04-06", "2021-04-07", "2021-04-08", "2021-04-09", "2021-04-10", "2021-04-11", "2021-04-12", "2021-04-13", "2021-04-14", "2021-04-15", "2021-04-16", "2021-04-17", "2021-04-18", "2021-04-19", "2021-04-20", "2021-04-21", "2021-04-22", "2021-04-23", "2021-04-24", "2021-04-25", "2021-04-26", "2021-04-27", "2021-04-28", "2021-04-29", "2021-04-30", "2021-05-01", "2021-05-02", "2021-05-03", "2021-05-04", "2021-05-05", "2021-05-06", "2021-05-07", "2021-05-08", "2021-05-09", "2021-05-10", "2021-05-11", "2021-05-12", "2021-05-13", "2021-05-14", "2021-05-15", "2021-05-16", "2021-05-17", "2021-05-18", "2021-05-19", "2021-05-20", "2021-05-21", "2021-05-22", "2021-05-23", "2021-05-24", "2021-05-25", "2021-05-26", "2021-05-27", "2021-05-28", "2021-05-29", "2021-05-30", "2021-05-31", "2021-06-01", "2021-06-02", "2021-06-03", "2021-06-04", "2021-06-05", "2021-06-06", "2021-06-07", "2021-06-08", "2021-06-09", "2021-06-10", "2021-06-11", "2021-06-12", "2021-06-13", "2021-06-14", "2021-06-15", "2021-06-16", "2021-06-17", "2021-06-18", "2021-06-19", "2021-06-20", "2021-06-21", "2021-06-22", "2021-06-23", "2021-06-24", "2021-06-25", "2021-06-26", "2021-06-27", "2021-06-28", "2021-06-29", "2021-06-30", "2021-07-01", "2021-07-02", "2021-07-03", "2021-07-04", "2021-07-05", "2021-07-06", "2021-07-07", "2021-07-08", "2021-07-09", "2021-07-10", "2021-07-11", "2021-07-12", "2021-07-13", "2021-07-14", "2021-07-15", "2021-07-16", "2021-07-17", "2021-07-18", "2021-07-19", "2021-07-20", "2021-07-21", "2021-07-22", "2021-07-23", "2021-07-24", "2021-07-25", "2021-07-26", "2021-07-27", "2021-07-28", "2021-07-29", "2021-07-30", "2021-07-31", "2021-08-01", "2021-08-02", "2021-08-03", "2021-08-04", "2021-08-05", "2021-08-06", "2021-08-07", "2021-08-08", "2021-08-09", "2021-08-10", "2021-08-11", "2021-08-12", "2021-08-13", "2021-08-14", "2021-08-15", "2021-08-16", "2021-08-17", "2021-08-18", "2021-08-19", "2021-08-20", "2021-08-21", "2021-08-22", "2021-08-23", "2021-08-24", "2021-08-25", "2021-08-26", "2021-08-27", "2021-08-28", "2021-08-29", "2021-08-30", "2021-08-31", "2021-09-01", "2021-09-02", "2021-09-03", "2021-09-04", "2021-09-05", "2021-09-06", "2021-09-07", "2021-09-08", "2021-09-09", "2021-09-10", "2021-09-11", "2021-09-12", "2021-09-13", "2021-09-14", "2021-09-15", "2021-09-16", "2021-09-17", "2021-09-18", "2021-09-19", "2021-09-20", "2021-09-21", "2021-09-22", "2021-09-23", "2021-09-24", "2021-09-25", "2021-09-26", "2021-09-27", "2021-09-28", "2021-09-29", "2021-09-30", "2021-10-01", "2021-10-02", "2021-10-03", "2021-10-04", "2021-10-05", "2021-10-06", "2021-10-07", "2021-10-08", "2021-10-09", "2021-10-10", "2021-10-11", "2021-10-12", "2021-10-13", "2021-10-14", "2021-10-15", "2021-10-16", "2021-10-17", "2021-10-18", "2021-10-19", "2021-10-20", "2021-10-21", "2021-10-22", "2021-10-23", "2021-10-24", "2021-10-25", "2021-10-26", "2021-10-27", "2021-10-28", "2021-10-29", "2021-10-30", "2021-10-31", "2021-11-01", "2021-11-02", "2021-11-03", "2021-11-04", "2021-11-05", "2021-11-06", "2021-11-07", "2021-11-08", "2021-11-09", "2021-11-10", "2021-11-11", "2021-11-12", "2021-11-13", "2021-11-14", "2021-11-15", "2021-11-16", "2021-11-17", "2021-11-18", "2021-11-19", "2021-11-20", "2021-11-21", "2021-11-22", "2021-11-23", "2021-11-24", "2021-11-25", "2021-11-26", "2021-11-27", "2021-11-28", "2021-11-29", "2021-11-30", "2021-12-01", "2021-12-02", "2021-12-03", "2021-12-04", "2021-12-05", "2021-12-06", "2021-12-07", "2021-12-08", "2021-12-09", "2021-12-10", "2021-12-11", "2021-12-12", "2021-12-13", "2021-12-14", "2021-12-15", "2021-12-16", "2021-12-17", "2021-12-18", "2021-12-19", "2021-12-20" ], "y": [ 78982.0, 79550.0, 80404.0, 81381.0, 82740.0, 84128.0, 86022.0, 88400.0, 90379.0, 92980.0, 95282.0, 98100.0, 102016.0, 106113.0, 110051.0, 114232.0, 119055.0, 126714.0, 132513.0, 146864.0, 157962.0, 169241.0, 184034.0, 200039.0, 219585.0, 246683.0, 277564.0, 309679.0, 344821.0, 387488.0, 428574.0, 479663.0, 542525.0, 607435.0, 677100.0, 734000.0, 799279.0, 876098.0, 959012.0, 1041923.0, 1126238.0, 1185171.0, 1256277.0, 1330151.0, 1399552.0, 1482877.0, 1570233.0, 1655623.0, 1730100.0, 1849635.0, 1920621.0, 2004469.0, 2082629.0, 2178015.0, 2266210.0, 2343459.0, 2420285.0, 2495724.0, 2571680.0, 2653519.0, 2737032.0, 2820960.0, 2903927.0, 2975368.0, 3045572.0, 3121378.0, 3198365.0, 3281736.0, 3370333.0, 3449993.0, 3524895.0, 3602083.0, 3682186.0, 3772588.0, 3861478.0, 3952059.0, 4036214.0, 4111910.0, 4188263.0, 4272702.0, 4357656.0, 4453534.0, 4549685.0, 4643963.0, 4722390.0, 4811104.0, 4907901.0, 5010022.0, 5116701.0, 5223039.0, 5327488.0, 5422310.0, 5508898.0, 5601705.0, 5705241.0, 5823758.0, 5944873.0, 6081734.0, 6188465.0, 6284170.0, 6405878.0, 6520061.0, 6650903.0, 6781973.0, 6915861.0, 7028667.0, 7129889.0, 7254441.0, 7389761.0, 7527047.0, 7656260.0, 7791268.0, 7924004.0, 8042352.0, 8183997.0, 8328754.0, 8469435.0, 8649623.0, 8807276.0, 8936132.0, 9074333.0, 9241366.0, 9414277.0, 9592716.0, 9784448.0, 9963205.0, 10128231.0, 10281763.0, 10458102.0, 10675387.0, 10885111.0, 11087877.0, 11284866.0, 11468563.0, 11632147.0, 11841875.0, 12055676.0, 12280599.0, 12513292.0, 12731078.0, 12925590.0, 13115565.0, 13336359.0, 13567328.0, 13819200.0, 14061993.0, 14299274.0, 14513690.0, 14719050.0, 14953642.0, 15233479.0, 15516190.0, 15798092.0, 16054210.0, 16268583.0, 16494404.0, 16744398.0, 17032640.0, 17312908.0, 17603693.0, 17855082.0, 18086471.0, 18292702.0, 18546826.0, 18824845.0, 19107849.0, 19391842.0, 19651494.0, 19878530.0, 20102018.0, 20364286.0, 20637694.0, 20927109.0, 21230510.0, 21481009.0, 21696390.0, 21902985.0, 22159127.0, 22435555.0, 22708757.0, 22969939.0, 23235515.0, 23442080.0, 23665636.0, 23910255.0, 24192561.0, 24477400.0, 24760761.0, 25026075.0, 25247621.0, 25507708.0, 25773751.0, 26056880.0, 26338480.0, 26652804.0, 26923244.0, 27153603.0, 27371786.0, 27612309.0, 27897617.0, 28197446.0, 28519172.0, 28806425.0, 29049361.0, 29311882.0, 29597281.0, 29901759.0, 30216605.0, 30542646.0, 30835407.0, 31088072.0, 31362678.0, 31647530.0, 31923532.0, 32277162.0, 32608418.0, 32897340.0, 33149335.0, 33403487.0, 33686356.0, 34012407.0, 34331133.0, 34629300.0, 34963530.0, 35223828.0, 35523271.0, 35849375.0, 36200620.0, 36562261.0, 36923518.0, 37281246.0, 37569264.0, 37860857.0, 38179108.0, 38560887.0, 38968266.0, 39380081.0, 39754819.0, 40071574.0, 40457800.0, 40846760.0, 41291515.0, 41763957.0, 42261626.0, 42719395.0, 43080668.0, 43565773.0, 44036488.0, 44548606.0, 45099299.0, 45671436.0, 46149712.0, 46613903.0, 47175195.0, 47731171.0, 48242555.0, 48839880.0, 49484835.0, 50086710.0, 50571432.0, 51070532.0, 51630860.0, 52282541.0, 52928985.0, 53582066.0, 54181625.0, 54657132.0, 55187672.0, 55799421.0, 56426867.0, 57081330.0, 57754077.0, 58345034.0, 58833226.0, 59355769.0, 59948912.0, 60587932.0, 61177148.0, 61859969.0, 62450021.0, 62939637.0, 63443499.0, 64063456.0, 64718440.0, 65415055.0, 66102868.0, 66752177.0, 67289500.0, 67804925.0, 68457269.0, 69129268.0, 70632838.0, 71341418.0, 71983206.0, 72513354.0, 73045112.0, 73697625.0, 74429582.0, 75171100.0, 75892701.0, 76517707.0, 77049860.0, 77590173.0, 78251816.0, 78948087.0, 79630256.0, 80110656.0, 80618354.0, 81051486.0, 81539629.0, 82212045.0, 82952755.0, 83730242.0, 84296867.0, 84902505.0, 85425466.0, 85975763.0, 86719562.0, 87510891.0, 88403612.0, 89220573.0, 89983425.0, 90574092.0, 91190679.0, 91891746.0, 92642919.0, 93403037.0, 94176533.0, 94824497.0, 95353518.0, 95867571.0, 96467235.0, 97164971.0, 97822462.0, 98483137.0, 99058210.0, 99516952.0, 100008166.0, 100564566.0, 101166796.0, 101781298.0, 102373122.0, 102894461.0, 103284132.0, 103728056.0, 104188170.0, 104715384.0, 105184805.0, 105720559.0, 106102332.0, 106508124.0, 106821888.0, 107252708.0, 107692052.0, 108136985.0, 108568533.0, 108946749.0, 109246808.0, 109533219.0, 109883548.0, 110281439.0, 110689338.0, 111103552.0, 111479381.0, 111800108.0, 112089864.0, 112481920.0, 112930072.0, 113381115.0, 113828089.0, 114222134.0, 114531134.0, 114835928.0, 115149390.0, 115593029.0, 116049356.0, 116499237.0, 116914405.0, 117287042.0, 117587330.0, 118002811.0, 118472219.0, 118951407.0, 119443197.0, 119900239.0, 120264658.0, 120613636.0, 121081197.0, 121632799.0, 122176702.0, 122741070.0, 123242578.0, 123679492.0, 124095806.0, 124611671.0, 125247138.0, 125900529.0, 126543456.0, 127129279.0, 127604710.0, 128062333.0, 128632321.0, 129317020.0, 130030677.0, 130667220.0, 131198894.0, 131754989.0, 132240747.0, 132846225.0, 133532336.0, 134373383.0, 135124143.0, 135792465.0, 136484798.0, 137098661.0, 137880192.0, 138696667.0, 139513781.0, 140371957.0, 141159967.0, 141846978.0, 142540040.0, 143394294.0, 144285880.0, 145185608.0, 146089862.0, 146912391.0, 147637518.0, 148319203.0, 149164564.0, 150072853.0, 150969915.0, 151850425.0, 152649158.0, 153324777.0, 154004283.0, 154812510.0, 155655358.0, 156525825.0, 157359303.0, 158146533.0, 158789066.0, 159408136.0, 160147581.0, 160908215.0, 161634056.0, 162352104.0, 162981424.0, 163530981.0, 164069867.0, 164692914.0, 165365336.0, 165645140.0, 166271771.0, 166851175.0, 167328452.0, 167780943.0, 168313798.0, 168883478.0, 169437807.0, 169938407.0, 170420732.0, 170812584.0, 171191420.0, 171654455.0, 172140687.0, 172630119.0, 173049855.0, 173449127.0, 173772425.0, 174093017.0, 174460244.0, 174880185.0, 175329896.0, 175750893.0, 176123749.0, 176427425.0, 176734807.0, 177106163.0, 177504878.0, 177897425.0, 178304313.0, 178653814.0, 178956210.0, 179249893.0, 179621721.0, 180059523.0, 180464448.0, 180886396.0, 181252433.0, 181563922.0, 181892266.0, 182271926.0, 182668927.0, 183109913.0, 183551185.0, 183927886.0, 184256405.0, 184625974.0, 185079412.0, 185542867.0, 186023223.0, 186530747.0, 186957804.0, 187328331.0, 187765023.0, 188285012.0, 188826481.0, 189398611.0, 189996899.0, 190470888.0, 190901907.0, 191398436.0, 191928383.0, 192487199.0, 193051598.0, 193780704.0, 194213638.0, 194658931.0, 195199303.0, 195809545.0, 196453856.0, 197106728.0, 197837028.0, 198347196.0, 198828497.0, 199406570.0, 200043981.0, 200719384.0, 201408323.0, 202230140.0, 202781068.0, 203222660.0, 203876492.0, 204525143.0, 205253670.0, 205964459.0, 206770170.0, 207304114.0, 207768135.0, 208446764.0, 209129842.0, 209858086.0, 210573753.0, 211363890.0, 211904096.0, 212350600.0, 213055084.0, 213742017.0, 214472351.0, 215208044.0, 215953778.0, 216501179.0, 216947753.0, 217634296.0, 218253486.0, 218980831.0, 219657848.0, 220375966.0, 220860684.0, 221300758.0, 221741269.0, 222466792.0, 223098493.0, 223736117.0, 224370105.0, 224826673.0, 225194926.0, 225796212.0, 226347579.0, 226915540.0, 227492096.0, 228085640.0, 228622696.0, 228983541.0, 229517614.0, 229986792.0, 230524963.0, 231036682.0, 231584263.0, 231951420.0, 232299752.0, 232772401.0, 233221863.0, 233724662.0, 234209428.0, 234748844.0, 235095500.0, 235401898.0, 235846427.0, 236266601.0, 236779559.0, 237212399.0, 237686871.0, 238019126.0, 238334055.0, 238716044.0, 239149353.0, 239612689.0, 240057253.0, 240514330.0, 240851606.0, 241164896.0, 241579658.0, 242021811.0, 242493015.0, 242949994.0, 243435643.0, 243795938.0, 244112020.0, 244543034.0, 244985800.0, 245498281.0, 245957361.0, 246462172.0, 246844135.0, 247164991.0, 247588056.0, 248017573.0, 248538786.0, 249066568.0, 249581899.0, 249996336.0, 250343524.0, 250822035.0, 251305151.0, 251879578.0, 252395690.0, 252990380.0, 253419091.0, 253770860.0, 254315828.0, 254837932.0, 255463123.0, 256078002.0, 256693733.0, 257170715.0, 257567185.0, 258192192.0, 258800096.0, 259472161.0, 260068316.0, 260663487.0, 261114328.0, 261520513.0, 262187526.0, 262812593.0, 263519456.0, 264220810.0, 264934820.0, 265441904.0, 265878644.0, 266472295.0, 267163771.0, 267835264.0, 268562192.0, 269250749.0, 269739491.0, 270171572.0, 270798369.0, 271472489.0, 272209108.0, 272943228.0, 273667294.0, 274233961.0, 274702744.0, 275466533.0 ], "yaxis": "y", "type": "scatter" }, { "line": { "color": "#636efa" }, "name": "Bitcoin", "x": [ "2020-02-23", "2020-02-24", "2020-02-25", "2020-02-26", "2020-02-27", "2020-02-28", "2020-02-29", "2020-03-01", "2020-03-02", "2020-03-03", "2020-03-04", "2020-03-05", "2020-03-06", "2020-03-07", "2020-03-08", "2020-03-09", "2020-03-10", "2020-03-11", "2020-03-12", "2020-03-13", "2020-03-14", "2020-03-15", "2020-03-16", "2020-03-17", "2020-03-18", "2020-03-19", "2020-03-20", "2020-03-21", "2020-03-22", "2020-03-23", "2020-03-24", "2020-03-25", "2020-03-26", "2020-03-27", "2020-03-28", "2020-03-29", "2020-03-30", "2020-03-31", "2020-04-01", "2020-04-02", "2020-04-03", "2020-04-04", "2020-04-05", "2020-04-06", "2020-04-07", "2020-04-08", "2020-04-09", "2020-04-10", "2020-04-11", "2020-04-12", "2020-04-13", "2020-04-14", "2020-04-15", "2020-04-16", "2020-04-17", "2020-04-18", "2020-04-19", "2020-04-20", "2020-04-21", "2020-04-22", "2020-04-23", "2020-04-24", "2020-04-25", "2020-04-26", "2020-04-27", "2020-04-28", "2020-04-29", "2020-04-30", "2020-05-01", "2020-05-02", "2020-05-03", "2020-05-04", "2020-05-05", "2020-05-06", "2020-05-07", "2020-05-08", "2020-05-09", "2020-05-10", "2020-05-11", "2020-05-12", "2020-05-13", "2020-05-14", "2020-05-15", "2020-05-16", "2020-05-17", "2020-05-18", "2020-05-19", "2020-05-20", "2020-05-21", "2020-05-22", "2020-05-23", "2020-05-24", "2020-05-25", "2020-05-26", "2020-05-27", "2020-05-28", "2020-05-29", "2020-05-30", "2020-05-31", "2020-06-01", "2020-06-02", "2020-06-03", "2020-06-04", "2020-06-05", "2020-06-06", "2020-06-07", "2020-06-08", "2020-06-09", "2020-06-10", "2020-06-11", "2020-06-12", "2020-06-13", "2020-06-14", "2020-06-15", "2020-06-16", "2020-06-17", "2020-06-18", "2020-06-19", "2020-06-20", "2020-06-21", "2020-06-22", "2020-06-23", "2020-06-24", "2020-06-25", "2020-06-26", "2020-06-27", "2020-06-28", "2020-06-29", "2020-06-30", "2020-07-01", "2020-07-02", "2020-07-03", "2020-07-04", "2020-07-05", "2020-07-06", "2020-07-07", "2020-07-08", "2020-07-09", "2020-07-10", "2020-07-11", "2020-07-12", "2020-07-13", "2020-07-14", "2020-07-15", "2020-07-16", "2020-07-17", "2020-07-18", "2020-07-19", "2020-07-20", "2020-07-21", "2020-07-22", "2020-07-23", "2020-07-24", "2020-07-25", "2020-07-26", "2020-07-27", "2020-07-28", "2020-07-29", "2020-07-30", "2020-07-31", "2020-08-01", "2020-08-02", "2020-08-03", "2020-08-04", "2020-08-05", "2020-08-06", "2020-08-07", "2020-08-08", "2020-08-09", "2020-08-10", "2020-08-11", "2020-08-12", "2020-08-13", "2020-08-14", "2020-08-15", "2020-08-16", "2020-08-17", "2020-08-18", "2020-08-19", "2020-08-20", "2020-08-21", "2020-08-22", "2020-08-23", "2020-08-24", "2020-08-25", "2020-08-26", "2020-08-27", "2020-08-28", "2020-08-29", "2020-08-30", "2020-08-31", "2020-09-01", "2020-09-02", "2020-09-03", "2020-09-04", "2020-09-05", "2020-09-06", "2020-09-07", "2020-09-08", "2020-09-09", "2020-09-10", "2020-09-11", "2020-09-12", "2020-09-13", "2020-09-14", "2020-09-15", "2020-09-16", "2020-09-17", "2020-09-18", "2020-09-19", "2020-09-20", "2020-09-21", "2020-09-22", "2020-09-23", "2020-09-24", "2020-09-25", "2020-09-26", "2020-09-27", "2020-09-28", "2020-09-29", "2020-09-30", "2020-10-01", "2020-10-02", "2020-10-03", "2020-10-04", "2020-10-05", "2020-10-06", "2020-10-07", "2020-10-08", "2020-10-09", "2020-10-10", "2020-10-11", "2020-10-12", "2020-10-13", "2020-10-14", "2020-10-15", "2020-10-16", "2020-10-17", "2020-10-18", "2020-10-19", "2020-10-20", "2020-10-21", "2020-10-22", "2020-10-23", "2020-10-24", "2020-10-25", "2020-10-26", "2020-10-27", "2020-10-28", "2020-10-29", "2020-10-30", "2020-10-31", "2020-11-01", "2020-11-02", "2020-11-03", "2020-11-04", "2020-11-05", "2020-11-06", "2020-11-07", "2020-11-08", "2020-11-09", "2020-11-10", "2020-11-11", "2020-11-12", "2020-11-13", "2020-11-14", "2020-11-15", "2020-11-16", "2020-11-17", "2020-11-18", "2020-11-19", "2020-11-20", "2020-11-21", "2020-11-22", "2020-11-23", "2020-11-24", "2020-11-25", "2020-11-26", "2020-11-27", "2020-11-28", "2020-11-29", "2020-11-30", "2020-12-01", "2020-12-02", "2020-12-03", "2020-12-04", "2020-12-05", "2020-12-06", "2020-12-07", "2020-12-08", "2020-12-09", "2020-12-10", "2020-12-11", "2020-12-12", "2020-12-13", "2020-12-14", "2020-12-15", "2020-12-16", "2020-12-17", "2020-12-18", "2020-12-19", "2020-12-20", "2020-12-21", "2020-12-22", "2020-12-23", "2020-12-24", "2020-12-25", "2020-12-26", "2020-12-27", "2020-12-28", "2020-12-29", "2020-12-30", "2020-12-31", "2021-01-01", "2021-01-02", "2021-01-03", "2021-01-04", "2021-01-05", "2021-01-06", "2021-01-07", "2021-01-08", "2021-01-09", "2021-01-10", "2021-01-11", "2021-01-12", "2021-01-13", "2021-01-14", "2021-01-15", "2021-01-16", "2021-01-17", "2021-01-18", "2021-01-19", "2021-01-20", "2021-01-21", "2021-01-22", "2021-01-23", "2021-01-24", "2021-01-25", "2021-01-26", "2021-01-27", "2021-01-28", "2021-01-29", "2021-01-30", "2021-01-31", "2021-02-01", "2021-02-02", "2021-02-03", "2021-02-04", "2021-02-05", "2021-02-06", "2021-02-07", "2021-02-08", "2021-02-09", "2021-02-10", "2021-02-11", "2021-02-12", "2021-02-13", "2021-02-14", "2021-02-15", "2021-02-16", "2021-02-17", "2021-02-18", "2021-02-19", "2021-02-20", "2021-02-21", "2021-02-22", "2021-02-23", "2021-02-24", "2021-02-25", "2021-02-26", "2021-02-27", "2021-02-28", "2021-03-01", "2021-03-02", "2021-03-03", "2021-03-04", "2021-03-05", "2021-03-06", "2021-03-07", "2021-03-08", "2021-03-09", "2021-03-10", "2021-03-11", "2021-03-12", "2021-03-13", "2021-03-14", "2021-03-15", "2021-03-16", "2021-03-17", "2021-03-18", "2021-03-19", "2021-03-20", "2021-03-21", "2021-03-22", "2021-03-23", "2021-03-24", "2021-03-25", "2021-03-26", "2021-03-27", "2021-03-28", "2021-03-29", "2021-03-30", "2021-03-31", "2021-04-01", "2021-04-02", "2021-04-03", "2021-04-04", "2021-04-05", "2021-04-06", "2021-04-07", "2021-04-08", "2021-04-09", "2021-04-10", "2021-04-11", "2021-04-12", "2021-04-13", "2021-04-14", "2021-04-15", "2021-04-16", "2021-04-17", "2021-04-18", "2021-04-19", "2021-04-20", "2021-04-21", "2021-04-22", "2021-04-23", "2021-04-24", "2021-04-25", "2021-04-26", "2021-04-27", "2021-04-28", "2021-04-29", "2021-04-30", "2021-05-01", "2021-05-02", "2021-05-03", "2021-05-04", "2021-05-05", "2021-05-06", "2021-05-07", "2021-05-08", "2021-05-09", "2021-05-10", "2021-05-11", "2021-05-12", "2021-05-13", "2021-05-14", "2021-05-15", "2021-05-16", "2021-05-17", "2021-05-18", "2021-05-19", "2021-05-20", "2021-05-21", "2021-05-22", "2021-05-23", "2021-05-24", "2021-05-25", "2021-05-26", "2021-05-27", "2021-05-28", "2021-05-29", "2021-05-30", "2021-05-31", "2021-06-01", "2021-06-02", "2021-06-03", "2021-06-04", "2021-06-05", "2021-06-06", "2021-06-07", "2021-06-08", "2021-06-09", "2021-06-10", "2021-06-11", "2021-06-12", "2021-06-13", "2021-06-14", "2021-06-15", "2021-06-16", "2021-06-17", "2021-06-18", "2021-06-19", "2021-06-20", "2021-06-21", "2021-06-22", "2021-06-23", "2021-06-24", "2021-06-25", "2021-06-26", "2021-06-27", "2021-06-28", "2021-06-29", "2021-06-30", "2021-07-01", "2021-07-02", "2021-07-03", "2021-07-04", "2021-07-05", "2021-07-06", "2021-07-07", "2021-07-08", "2021-07-09", "2021-07-10", "2021-07-11", "2021-07-12", "2021-07-13", "2021-07-14", "2021-07-15", "2021-07-16", "2021-07-17", "2021-07-18", "2021-07-19", "2021-07-20", "2021-07-21", "2021-07-22", "2021-07-23", "2021-07-24", "2021-07-25", "2021-07-26", "2021-07-27", "2021-07-28", "2021-07-29", "2021-07-30", "2021-07-31", "2021-08-01", "2021-08-02", "2021-08-03", "2021-08-04", "2021-08-05", "2021-08-06", "2021-08-07", "2021-08-08", "2021-08-09", "2021-08-10", "2021-08-11", "2021-08-12", "2021-08-13", "2021-08-14", "2021-08-15", "2021-08-16", "2021-08-17", "2021-08-18", "2021-08-19", "2021-08-20", "2021-08-21", "2021-08-22", "2021-08-23", "2021-08-24", "2021-08-25", "2021-08-26", "2021-08-27", "2021-08-28", "2021-08-29", "2021-08-30", "2021-08-31", "2021-09-01", "2021-09-02", "2021-09-03", "2021-09-04", "2021-09-05", "2021-09-06", "2021-09-07", "2021-09-08", "2021-09-09", "2021-09-10", "2021-09-11", "2021-09-12", "2021-09-13", "2021-09-14", "2021-09-15", "2021-09-16", "2021-09-17", "2021-09-18", "2021-09-19", "2021-09-20", "2021-09-21", "2021-09-22", "2021-09-23", "2021-09-24", "2021-09-25", "2021-09-26", "2021-09-27", "2021-09-28", "2021-09-29", "2021-09-30", "2021-10-01", "2021-10-02", "2021-10-03", "2021-10-04", "2021-10-05", "2021-10-06", "2021-10-07", "2021-10-08", "2021-10-09", "2021-10-10", "2021-10-11", "2021-10-12", "2021-10-13", "2021-10-14", "2021-10-15", "2021-10-16", "2021-10-17", "2021-10-18", "2021-10-19", "2021-10-20", "2021-10-21", "2021-10-22", "2021-10-23", "2021-10-24", "2021-10-25", "2021-10-26", "2021-10-27", "2021-10-28", "2021-10-29", "2021-10-30", "2021-10-31", "2021-11-01", "2021-11-02", "2021-11-03", "2021-11-04", "2021-11-05", "2021-11-06", "2021-11-07", "2021-11-08", "2021-11-09", "2021-11-10", "2021-11-11", "2021-11-12", "2021-11-13", "2021-11-14", "2021-11-15", "2021-11-16", "2021-11-17", "2021-11-18", "2021-11-19", "2021-11-20", "2021-11-21", "2021-11-22", "2021-11-23", "2021-11-24", "2021-11-25", "2021-11-26", "2021-11-27", "2021-11-28", "2021-11-29", "2021-11-30", "2021-12-01", "2021-12-02", "2021-12-03", "2021-12-04", "2021-12-05", "2021-12-06", "2021-12-07", "2021-12-08", "2021-12-09", "2021-12-10", "2021-12-11", "2021-12-12", "2021-12-13", "2021-12-14", "2021-12-15", "2021-12-16", "2021-12-17", "2021-12-18", "2021-12-19", "2021-12-20" ], "y": [ 100.0, 97.24, 94.13, 88.88, 88.51, 87.38, 86.65, 86.28, 89.37, 88.55, 88.22, 91.48, 91.92, 89.78, 81.7, 79.84, 79.7, 79.72, 50.09, 56.06, 52.4, 54.33, 50.53, 52.65, 52.78, 62.38, 62.46, 62.32, 58.75, 64.65, 67.86, 67.32, 67.68, 65.19, 62.9, 59.67, 64.79, 64.88, 66.57, 68.45, 67.85, 69.2, 68.43, 73.27, 72.31, 73.9, 73.58, 69.18, 69.11, 70.24, 68.97, 68.94, 66.93, 71.71, 71.5, 73.13, 72.44, 69.34, 69.33, 71.71, 74.86, 76.08, 76.28, 77.38, 78.55, 78.66, 88.68, 87.24, 89.32, 90.57, 89.65, 89.8, 90.72, 93.39, 100.27, 99.18, 96.67, 88.23, 86.67, 88.71, 93.4, 98.08, 93.99, 94.48, 97.44, 98.01, 98.03, 95.95, 91.51, 92.52, 92.79, 88.57, 89.75, 89.02, 92.51, 95.98, 95.11, 97.74, 95.33, 102.45, 96.02, 97.3, 98.75, 97.39, 97.27, 98.33, 98.46, 98.7, 99.45, 93.93, 95.53, 95.47, 94.58, 95.23, 96.11, 95.52, 94.83, 93.59, 94.03, 93.74, 97.22, 97.03, 93.84, 93.35, 92.33, 91.14, 92.13, 92.61, 92.07, 92.99, 91.93, 91.56, 92.02, 91.43, 94.47, 93.23, 95.0, 93.49, 93.49, 93.11, 93.47, 93.14, 93.14, 92.63, 92.02, 92.21, 92.29, 92.56, 92.34, 94.46, 95.98, 96.54, 96.09, 97.51, 99.81, 110.74, 109.96, 111.85, 111.96, 114.1, 118.49, 111.38, 113.32, 112.91, 118.36, 118.69, 116.9, 118.43, 117.65, 119.68, 114.97, 116.73, 118.74, 118.58, 119.56, 119.83, 123.48, 120.82, 118.48, 119.69, 116.81, 117.71, 117.54, 118.64, 114.53, 115.76, 114.1, 116.3, 115.94, 118.01, 117.7, 120.62, 115.01, 103.23, 105.92, 102.47, 103.59, 104.48, 102.09, 103.2, 104.42, 104.8, 105.22, 104.02, 107.62, 108.79, 110.58, 110.32, 110.28, 111.79, 110.21, 105.42, 106.19, 103.24, 108.42, 107.74, 108.32, 108.57, 107.91, 109.27, 108.67, 107.0, 106.56, 106.3, 107.51, 108.75, 106.85, 107.5, 109.99, 111.49, 113.82, 114.71, 116.43, 115.13, 115.16, 115.83, 114.08, 114.44, 115.71, 118.31, 120.07, 129.21, 130.65, 130.3, 132.08, 131.3, 131.75, 137.58, 133.72, 135.4, 136.5, 138.86, 138.42, 136.54, 140.56, 142.41, 156.98, 156.84, 149.47, 155.97, 154.49, 154.07, 158.21, 164.0, 164.42, 161.9, 160.77, 168.43, 177.8, 179.39, 179.53, 187.63, 187.84, 185.1, 185.04, 192.53, 188.75, 172.81, 172.39, 178.52, 183.16, 197.75, 189.46, 193.47, 195.93, 188.42, 193.0, 194.92, 193.38, 184.6, 186.95, 184.04, 181.96, 189.47, 192.88, 193.93, 195.65, 214.73, 229.79, 233.14, 240.51, 236.56, 229.77, 239.64, 234.18, 239.16, 248.52, 266.38, 264.72, 272.91, 275.71, 290.6, 292.22, 295.98, 323.72, 330.31, 322.15, 342.51, 371.04, 396.7, 411.08, 405.61, 386.48, 358.37, 341.81, 376.0, 394.85, 371.05, 364.53, 360.64, 369.09, 363.44, 358.18, 310.6, 332.57, 323.12, 325.35, 326.13, 328.18, 306.64, 337.21, 345.77, 345.3, 333.66, 337.92, 357.8, 377.57, 372.07, 384.34, 395.65, 391.99, 465.48, 468.35, 452.6, 482.74, 478.66, 474.64, 490.88, 483.1, 495.74, 525.46, 520.73, 563.13, 565.26, 579.78, 546.2, 491.96, 500.83, 474.52, 466.92, 465.4, 454.81, 500.09, 487.47, 509.23, 489.31, 492.99, 492.84, 515.96, 526.44, 552.41, 564.35, 582.45, 577.68, 617.09, 597.53, 563.32, 572.37, 593.19, 582.99, 587.9, 587.57, 579.61, 549.44, 551.55, 531.76, 520.97, 555.57, 563.99, 563.76, 581.89, 593.66, 593.67, 595.45, 598.36, 580.42, 592.05, 595.07, 586.35, 564.75, 587.68, 586.88, 602.48, 606.63, 603.49, 639.86, 635.9, 637.96, 620.41, 611.45, 566.44, 561.48, 569.03, 543.16, 521.56, 514.82, 504.32, 493.77, 544.33, 554.52, 552.42, 539.62, 581.89, 582.68, 570.62, 576.35, 537.39, 578.61, 568.25, 577.93, 592.51, 586.75, 562.85, 571.36, 495.24, 500.94, 502.6, 471.16, 468.09, 438.69, 432.36, 372.84, 410.93, 375.88, 378.22, 350.35, 390.0, 386.94, 395.93, 387.29, 359.69, 348.79, 359.49, 376.17, 369.64, 378.61, 395.07, 371.75, 358.22, 361.35, 338.16, 337.27, 376.29, 369.82, 376.18, 358.23, 393.95, 405.24, 407.14, 386.39, 383.43, 360.59, 358.87, 359.7, 319.18, 327.53, 339.8, 349.26, 318.78, 324.31, 349.13, 346.96, 361.41, 353.07, 338.27, 341.55, 349.32, 355.56, 340.03, 344.96, 341.13, 331.27, 340.55, 337.75, 345.01, 334.08, 329.51, 330.72, 320.22, 316.61, 317.73, 320.39, 310.52, 300.34, 323.55, 325.59, 338.37, 345.53, 356.19, 376.22, 397.07, 403.0, 403.13, 425.57, 419.43, 402.79, 395.0, 384.43, 400.5, 411.8, 431.42, 448.95, 441.31, 467.18, 459.32, 459.4, 447.66, 481.57, 474.55, 474.05, 463.54, 450.35, 451.42, 470.73, 497.14, 492.77, 496.97, 499.23, 480.69, 493.33, 472.99, 494.32, 492.74, 492.01, 474.13, 475.25, 492.19, 497.03, 504.06, 503.24, 521.47, 530.34, 471.67, 464.42, 467.44, 452.25, 455.45, 464.14, 453.05, 474.51, 485.43, 481.47, 476.27, 486.46, 476.2, 431.7, 410.03, 439.06, 452.37, 431.66, 430.41, 435.37, 425.57, 413.47, 418.8, 441.24, 484.83, 480.74, 485.67, 494.86, 519.07, 557.83, 542.15, 543.78, 553.86, 551.88, 579.22, 564.67, 578.38, 577.58, 620.62, 613.55, 620.22, 624.98, 647.51, 664.95, 626.83, 611.54, 618.61, 613.94, 635.19, 608.23, 589.27, 610.83, 627.01, 623.6, 617.85, 614.68, 637.07, 634.49, 619.2, 615.91, 619.95, 638.09, 680.81, 674.81, 654.9, 654.44, 646.44, 649.6, 659.65, 640.41, 606.19, 608.27, 573.75, 585.62, 601.51, 591.77, 567.17, 580.07, 567.08, 577.1, 539.77, 552.32, 576.84, 582.46, 574.39, 576.65, 569.07, 540.06, 495.75, 497.44, 509.67, 510.86, 508.89, 480.35, 476.03, 497.38, 504.79, 470.93, 469.67, 492.69, 480.28, 465.54, 472.05, 470.62, 472.37 ], "yaxis": "y2", "type": "scatter" }, { "line": { "color": "#00cc96" }, "name": "Dow Jones", "x": [ "2020-02-23", "2020-02-24", "2020-02-25", "2020-02-26", "2020-02-27", "2020-02-28", "2020-02-29", "2020-03-01", "2020-03-02", "2020-03-03", "2020-03-04", "2020-03-05", "2020-03-06", "2020-03-07", "2020-03-08", "2020-03-09", "2020-03-10", "2020-03-11", "2020-03-12", "2020-03-13", "2020-03-14", "2020-03-15", "2020-03-16", "2020-03-17", "2020-03-18", "2020-03-19", "2020-03-20", "2020-03-21", "2020-03-22", "2020-03-23", "2020-03-24", "2020-03-25", "2020-03-26", "2020-03-27", "2020-03-28", "2020-03-29", "2020-03-30", "2020-03-31", "2020-04-01", "2020-04-02", "2020-04-03", "2020-04-04", "2020-04-05", "2020-04-06", "2020-04-07", "2020-04-08", "2020-04-09", "2020-04-10", "2020-04-11", "2020-04-12", "2020-04-13", "2020-04-14", "2020-04-15", "2020-04-16", "2020-04-17", "2020-04-18", "2020-04-19", "2020-04-20", "2020-04-21", "2020-04-22", "2020-04-23", "2020-04-24", "2020-04-25", "2020-04-26", "2020-04-27", "2020-04-28", "2020-04-29", "2020-04-30", "2020-05-01", "2020-05-02", "2020-05-03", "2020-05-04", "2020-05-05", "2020-05-06", "2020-05-07", "2020-05-08", "2020-05-09", "2020-05-10", "2020-05-11", "2020-05-12", "2020-05-13", "2020-05-14", "2020-05-15", "2020-05-16", "2020-05-17", "2020-05-18", "2020-05-19", "2020-05-20", "2020-05-21", "2020-05-22", "2020-05-23", "2020-05-24", "2020-05-25", "2020-05-26", "2020-05-27", "2020-05-28", "2020-05-29", "2020-05-30", "2020-05-31", "2020-06-01", "2020-06-02", "2020-06-03", "2020-06-04", "2020-06-05", "2020-06-06", "2020-06-07", "2020-06-08", "2020-06-09", "2020-06-10", "2020-06-11", "2020-06-12", "2020-06-13", "2020-06-14", "2020-06-15", "2020-06-16", "2020-06-17", "2020-06-18", "2020-06-19", "2020-06-20", "2020-06-21", "2020-06-22", "2020-06-23", "2020-06-24", "2020-06-25", "2020-06-26", "2020-06-27", "2020-06-28", "2020-06-29", "2020-06-30", "2020-07-01", "2020-07-02", "2020-07-03", "2020-07-04", "2020-07-05", "2020-07-06", "2020-07-07", "2020-07-08", "2020-07-09", "2020-07-10", "2020-07-11", "2020-07-12", "2020-07-13", "2020-07-14", "2020-07-15", "2020-07-16", "2020-07-17", "2020-07-18", "2020-07-19", "2020-07-20", "2020-07-21", "2020-07-22", "2020-07-23", "2020-07-24", "2020-07-25", "2020-07-26", "2020-07-27", "2020-07-28", "2020-07-29", "2020-07-30", "2020-07-31", "2020-08-01", "2020-08-02", "2020-08-03", "2020-08-04", "2020-08-05", "2020-08-06", "2020-08-07", "2020-08-08", "2020-08-09", "2020-08-10", "2020-08-11", "2020-08-12", "2020-08-13", "2020-08-14", "2020-08-15", "2020-08-16", "2020-08-17", "2020-08-18", "2020-08-19", "2020-08-20", "2020-08-21", "2020-08-22", "2020-08-23", "2020-08-24", "2020-08-25", "2020-08-26", "2020-08-27", "2020-08-28", "2020-08-29", "2020-08-30", "2020-08-31", "2020-09-01", "2020-09-02", "2020-09-03", "2020-09-04", "2020-09-05", "2020-09-06", "2020-09-07", "2020-09-08", "2020-09-09", "2020-09-10", "2020-09-11", "2020-09-12", "2020-09-13", "2020-09-14", "2020-09-15", "2020-09-16", "2020-09-17", "2020-09-18", "2020-09-19", "2020-09-20", "2020-09-21", "2020-09-22", "2020-09-23", "2020-09-24", "2020-09-25", "2020-09-26", "2020-09-27", "2020-09-28", "2020-09-29", "2020-09-30", "2020-10-01", "2020-10-02", "2020-10-03", "2020-10-04", "2020-10-05", "2020-10-06", "2020-10-07", "2020-10-08", "2020-10-09", "2020-10-10", "2020-10-11", "2020-10-12", "2020-10-13", "2020-10-14", "2020-10-15", "2020-10-16", "2020-10-17", "2020-10-18", "2020-10-19", "2020-10-20", "2020-10-21", "2020-10-22", "2020-10-23", "2020-10-24", "2020-10-25", "2020-10-26", "2020-10-27", "2020-10-28", "2020-10-29", "2020-10-30", "2020-10-31", "2020-11-01", "2020-11-02", "2020-11-03", "2020-11-04", "2020-11-05", "2020-11-06", "2020-11-07", "2020-11-08", "2020-11-09", "2020-11-10", "2020-11-11", "2020-11-12", "2020-11-13", "2020-11-14", "2020-11-15", "2020-11-16", "2020-11-17", "2020-11-18", "2020-11-19", "2020-11-20", "2020-11-21", "2020-11-22", "2020-11-23", "2020-11-24", "2020-11-25", "2020-11-26", "2020-11-27", "2020-11-28", "2020-11-29", "2020-11-30", "2020-12-01", "2020-12-02", "2020-12-03", "2020-12-04", "2020-12-05", "2020-12-06", "2020-12-07", "2020-12-08", "2020-12-09", "2020-12-10", "2020-12-11", "2020-12-12", "2020-12-13", "2020-12-14", "2020-12-15", "2020-12-16", "2020-12-17", "2020-12-18", "2020-12-19", "2020-12-20", "2020-12-21", "2020-12-22", "2020-12-23", "2020-12-24", "2020-12-25", "2020-12-26", "2020-12-27", "2020-12-28", "2020-12-29", "2020-12-30", "2020-12-31", "2021-01-01", "2021-01-02", "2021-01-03", "2021-01-04", "2021-01-05", "2021-01-06", "2021-01-07", "2021-01-08", "2021-01-09", "2021-01-10", "2021-01-11", "2021-01-12", "2021-01-13", "2021-01-14", "2021-01-15", "2021-01-16", "2021-01-17", "2021-01-18", "2021-01-19", "2021-01-20", "2021-01-21", "2021-01-22", "2021-01-23", "2021-01-24", "2021-01-25", "2021-01-26", "2021-01-27", "2021-01-28", "2021-01-29", "2021-01-30", "2021-01-31", "2021-02-01", "2021-02-02", "2021-02-03", "2021-02-04", "2021-02-05", "2021-02-06", "2021-02-07", "2021-02-08", "2021-02-09", "2021-02-10", "2021-02-11", "2021-02-12", "2021-02-13", "2021-02-14", "2021-02-15", "2021-02-16", "2021-02-17", "2021-02-18", "2021-02-19", "2021-02-20", "2021-02-21", "2021-02-22", "2021-02-23", "2021-02-24", "2021-02-25", "2021-02-26", "2021-02-27", "2021-02-28", "2021-03-01", "2021-03-02", "2021-03-03", "2021-03-04", "2021-03-05", "2021-03-06", "2021-03-07", "2021-03-08", "2021-03-09", "2021-03-10", "2021-03-11", "2021-03-12", "2021-03-13", "2021-03-14", "2021-03-15", "2021-03-16", "2021-03-17", "2021-03-18", "2021-03-19", "2021-03-20", "2021-03-21", "2021-03-22", "2021-03-23", "2021-03-24", "2021-03-25", "2021-03-26", "2021-03-27", "2021-03-28", "2021-03-29", "2021-03-30", "2021-03-31", "2021-04-01", "2021-04-02", "2021-04-03", "2021-04-04", "2021-04-05", "2021-04-06", "2021-04-07", "2021-04-08", "2021-04-09", "2021-04-10", "2021-04-11", "2021-04-12", "2021-04-13", "2021-04-14", "2021-04-15", "2021-04-16", "2021-04-17", "2021-04-18", "2021-04-19", "2021-04-20", "2021-04-21", "2021-04-22", "2021-04-23", "2021-04-24", "2021-04-25", "2021-04-26", "2021-04-27", "2021-04-28", "2021-04-29", "2021-04-30", "2021-05-01", "2021-05-02", "2021-05-03", "2021-05-04", "2021-05-05", "2021-05-06", "2021-05-07", "2021-05-08", "2021-05-09", "2021-05-10", "2021-05-11", "2021-05-12", "2021-05-13", "2021-05-14", "2021-05-15", "2021-05-16", "2021-05-17", "2021-05-18", "2021-05-19", "2021-05-20", "2021-05-21", "2021-05-22", "2021-05-23", "2021-05-24", "2021-05-25", "2021-05-26", "2021-05-27", "2021-05-28", "2021-05-29", "2021-05-30", "2021-05-31", "2021-06-01", "2021-06-02", "2021-06-03", "2021-06-04", "2021-06-05", "2021-06-06", "2021-06-07", "2021-06-08", "2021-06-09", "2021-06-10", "2021-06-11", "2021-06-12", "2021-06-13", "2021-06-14", "2021-06-15", "2021-06-16", "2021-06-17", "2021-06-18", "2021-06-19", "2021-06-20", "2021-06-21", "2021-06-22", "2021-06-23", "2021-06-24", "2021-06-25", "2021-06-26", "2021-06-27", "2021-06-28", "2021-06-29", "2021-06-30", "2021-07-01", "2021-07-02", "2021-07-03", "2021-07-04", "2021-07-05", "2021-07-06", "2021-07-07", "2021-07-08", "2021-07-09", "2021-07-10", "2021-07-11", "2021-07-12", "2021-07-13", "2021-07-14", "2021-07-15", "2021-07-16", "2021-07-17", "2021-07-18", "2021-07-19", "2021-07-20", "2021-07-21", "2021-07-22", "2021-07-23", "2021-07-24", "2021-07-25", "2021-07-26", "2021-07-27", "2021-07-28", "2021-07-29", "2021-07-30", "2021-07-31", "2021-08-01", "2021-08-02", "2021-08-03", "2021-08-04", "2021-08-05", "2021-08-06", "2021-08-07", "2021-08-08", "2021-08-09", "2021-08-10", "2021-08-11", "2021-08-12", "2021-08-13", "2021-08-14", "2021-08-15", "2021-08-16", "2021-08-17", "2021-08-18", "2021-08-19", "2021-08-20", "2021-08-21", "2021-08-22", "2021-08-23", "2021-08-24", "2021-08-25", "2021-08-26", "2021-08-27", "2021-08-28", "2021-08-29", "2021-08-30", "2021-08-31", "2021-09-01", "2021-09-02", "2021-09-03", "2021-09-04", "2021-09-05", "2021-09-06", "2021-09-07", "2021-09-08", "2021-09-09", "2021-09-10", "2021-09-11", "2021-09-12", "2021-09-13", "2021-09-14", "2021-09-15", "2021-09-16", "2021-09-17", "2021-09-18", "2021-09-19", "2021-09-20", "2021-09-21", "2021-09-22", "2021-09-23", "2021-09-24", "2021-09-25", "2021-09-26", "2021-09-27", "2021-09-28", "2021-09-29", "2021-09-30", "2021-10-01", "2021-10-02", "2021-10-03", "2021-10-04", "2021-10-05", "2021-10-06", "2021-10-07", "2021-10-08", "2021-10-09", "2021-10-10", "2021-10-11", "2021-10-12", "2021-10-13", "2021-10-14", "2021-10-15", "2021-10-16", "2021-10-17", "2021-10-18", "2021-10-19", "2021-10-20", "2021-10-21", "2021-10-22", "2021-10-23", "2021-10-24", "2021-10-25", "2021-10-26", "2021-10-27", "2021-10-28", "2021-10-29", "2021-10-30", "2021-10-31", "2021-11-01", "2021-11-02", "2021-11-03", "2021-11-04", "2021-11-05", "2021-11-06", "2021-11-07", "2021-11-08", "2021-11-09", "2021-11-10", "2021-11-11", "2021-11-12", "2021-11-13", "2021-11-14", "2021-11-15", "2021-11-16", "2021-11-17", "2021-11-18", "2021-11-19", "2021-11-20", "2021-11-21", "2021-11-22", "2021-11-23", "2021-11-24", "2021-11-25", "2021-11-26", "2021-11-27", "2021-11-28", "2021-11-29", "2021-11-30", "2021-12-01", "2021-12-02", "2021-12-03", "2021-12-04", "2021-12-05", "2021-12-06", "2021-12-07", "2021-12-08", "2021-12-09", "2021-12-10", "2021-12-11", "2021-12-12", "2021-12-13", "2021-12-14", "2021-12-15", "2021-12-16", "2021-12-17", "2021-12-18", "2021-12-19", "2021-12-20" ], "y": [ 100.0, 98.79, 95.68, 95.24, 91.03, 89.77, 91.29, 92.82, 94.34, 91.57, 95.71, 92.29, 91.38, 89.01, 86.64, 84.27, 88.39, 83.21, 74.9, 81.91, 78.38, 74.86, 71.33, 75.03, 70.3, 70.97, 67.74, 67.06, 66.37, 65.69, 73.15, 74.9, 79.68, 76.44, 77.26, 78.07, 78.88, 77.43, 73.99, 75.65, 74.38, 76.29, 78.21, 80.13, 80.04, 82.79, 83.8, 83.51, 83.22, 82.93, 82.64, 84.61, 83.04, 83.16, 85.65, 84.95, 84.25, 83.56, 81.33, 82.94, 83.08, 84.0, 84.42, 84.84, 85.26, 85.15, 87.03, 86.01, 83.82, 83.85, 83.88, 83.91, 84.38, 83.61, 84.35, 85.96, 85.83, 85.7, 85.58, 83.96, 82.13, 83.47, 83.68, 84.75, 85.83, 86.9, 85.52, 86.83, 86.47, 86.44, 86.9, 87.37, 87.84, 88.31, 90.26, 89.74, 89.68, 89.79, 89.89, 90.0, 90.95, 92.81, 92.85, 95.78, 96.33, 96.87, 97.41, 96.35, 95.36, 88.78, 90.46, 90.65, 90.84, 91.02, 92.88, 92.28, 92.14, 91.4, 91.58, 91.77, 91.95, 92.41, 89.9, 90.96, 88.38, 89.06, 89.75, 90.43, 91.2, 90.92, 91.25, 91.65, 92.06, 92.47, 92.87, 91.47, 92.1, 90.82, 92.12, 92.14, 92.15, 92.16, 94.13, 94.93, 94.45, 94.23, 94.24, 94.25, 94.26, 94.83, 95.41, 94.16, 93.52, 93.65, 93.79, 93.92, 93.2, 93.76, 92.97, 93.37, 93.65, 93.93, 94.2, 94.78, 96.1, 96.76, 96.92, 97.34, 97.77, 98.19, 97.82, 98.84, 98.56, 98.68, 98.58, 98.48, 98.38, 98.14, 97.84, 98.0, 98.68, 99.12, 99.57, 100.01, 99.8, 100.1, 100.66, 101.23, 100.97, 100.71, 100.44, 101.2, 102.81, 99.96, 99.39, 98.84, 98.28, 97.72, 97.16, 98.71, 97.28, 97.74, 98.13, 98.51, 98.9, 98.91, 99.04, 98.58, 97.71, 97.11, 96.51, 95.91, 96.41, 94.55, 94.74, 96.01, 96.49, 96.97, 97.45, 96.99, 98.15, 98.28, 97.8, 98.35, 98.9, 99.45, 98.12, 100.0, 100.43, 101.0, 101.29, 101.59, 101.88, 101.33, 100.74, 100.67, 101.07, 100.58, 100.1, 99.61, 100.01, 99.67, 100.21, 100.11, 99.34, 98.58, 97.81, 97.03, 93.69, 94.19, 93.63, 94.13, 94.63, 95.13, 97.09, 98.39, 100.3, 100.07, 101.05, 102.03, 103.01, 103.94, 103.86, 102.74, 104.15, 104.71, 105.26, 105.81, 105.22, 104.01, 104.16, 103.39, 103.77, 104.16, 104.55, 106.15, 105.54, 105.61, 105.67, 105.35, 105.03, 104.71, 105.37, 105.58, 105.88, 106.76, 106.59, 106.41, 106.24, 106.6, 106.23, 105.99, 106.15, 105.94, 105.72, 105.5, 106.69, 106.54, 107.06, 106.62, 106.67, 106.71, 106.75, 106.04, 106.45, 106.7, 106.88, 107.06, 107.24, 107.42, 107.18, 107.44, 108.13, 107.79, 107.46, 107.12, 106.78, 107.37, 108.92, 109.67, 109.87, 109.76, 109.66, 109.55, 109.77, 109.74, 109.49, 108.87, 108.97, 109.07, 109.17, 109.28, 110.19, 110.14, 109.51, 109.47, 109.42, 109.38, 109.3, 107.06, 108.12, 105.93, 106.2, 106.47, 106.74, 108.42, 108.55, 109.72, 110.05, 110.33, 110.61, 110.89, 110.85, 111.07, 111.04, 111.14, 111.2, 111.26, 111.31, 111.37, 111.69, 111.27, 111.27, 111.3, 111.33, 111.37, 111.42, 112.92, 110.94, 109.28, 109.99, 110.7, 111.41, 110.91, 110.48, 109.25, 111.28, 111.64, 112.0, 112.36, 112.46, 114.1, 114.77, 115.81, 116.01, 116.22, 116.42, 115.97, 116.64, 116.1, 115.27, 115.4, 115.52, 115.64, 114.55, 114.54, 115.24, 116.85, 116.96, 117.08, 117.19, 116.83, 116.52, 117.13, 117.46, 117.79, 118.12, 118.45, 118.11, 118.17, 118.37, 119.42, 119.35, 119.29, 119.22, 118.98, 119.17, 120.25, 120.83, 120.69, 120.54, 120.4, 119.49, 120.61, 119.47, 120.28, 120.2, 120.13, 120.06, 120.07, 119.49, 120.33, 119.68, 119.96, 120.24, 120.52, 120.59, 120.94, 122.06, 122.87, 122.83, 122.79, 122.75, 121.07, 118.66, 120.2, 121.47, 121.41, 121.34, 121.28, 120.34, 119.75, 120.42, 120.86, 121.08, 121.29, 121.51, 121.23, 121.26, 121.76, 121.99, 122.03, 122.07, 122.11, 122.15, 122.24, 122.16, 122.79, 122.65, 122.5, 122.35, 122.24, 121.7, 121.77, 121.82, 121.71, 121.61, 121.51, 121.18, 120.24, 119.5, 117.61, 118.3, 119.0, 119.69, 119.93, 119.68, 120.82, 121.65, 121.48, 121.3, 121.12, 121.15, 121.9, 122.36, 122.9, 122.72, 122.53, 122.35, 122.16, 122.53, 121.61, 123.2, 123.34, 123.49, 123.64, 123.26, 123.42, 123.61, 122.55, 121.7, 120.84, 119.99, 121.93, 122.94, 123.03, 123.87, 123.97, 124.07, 124.16, 123.86, 123.41, 123.95, 123.43, 123.31, 123.2, 123.08, 124.07, 122.92, 123.88, 124.39, 124.27, 124.14, 124.01, 124.59, 125.37, 125.42, 125.48, 125.6, 125.73, 125.86, 124.87, 123.52, 123.28, 124.08, 124.33, 124.59, 124.84, 124.95, 125.09, 124.41, 125.26, 125.2, 125.13, 125.07, 124.93, 124.76, 125.22, 124.96, 124.72, 124.48, 124.25, 124.01, 123.76, 123.23, 122.27, 122.58, 122.89, 123.19, 122.16, 123.0, 122.78, 122.19, 121.46, 120.74, 120.02, 119.84, 121.03, 122.82, 122.94, 123.02, 123.11, 123.19, 121.18, 121.5, 119.57, 121.27, 120.89, 120.51, 120.13, 121.23, 121.59, 122.79, 122.76, 122.46, 122.17, 121.87, 121.46, 121.46, 123.35, 124.7, 124.65, 124.61, 124.57, 125.27, 125.81, 125.79, 126.05, 126.12, 126.2, 126.27, 126.33, 125.39, 126.24, 126.55, 126.66, 126.77, 126.88, 127.37, 127.74, 127.63, 128.35, 128.47, 128.59, 128.71, 128.32, 127.47, 126.91, 127.54, 127.53, 127.51, 127.5, 127.69, 126.94, 126.73, 125.78, 125.8, 125.82, 125.84, 126.53, 126.5, 124.9, 123.3, 123.58, 123.86, 124.13, 121.83, 120.2, 122.38, 122.17, 122.93, 123.69, 124.46, 126.2, 126.32, 126.32, 127.08, 126.71, 126.33, 125.95, 125.58, 126.93, 126.83, 124.95, 124.44, 123.93, 123.41 ], "yaxis": "y2", "type": "scatter" }, { "line": { "color": "#FFA15A" }, "name": "Gold", "x": [ "2020-02-23", "2020-02-24", "2020-02-25", "2020-02-26", "2020-02-27", "2020-02-28", "2020-02-29", "2020-03-01", "2020-03-02", "2020-03-03", "2020-03-04", "2020-03-05", "2020-03-06", "2020-03-07", "2020-03-08", "2020-03-09", "2020-03-10", "2020-03-11", "2020-03-12", "2020-03-13", "2020-03-14", "2020-03-15", "2020-03-16", "2020-03-17", "2020-03-18", "2020-03-19", "2020-03-20", "2020-03-21", "2020-03-22", "2020-03-23", "2020-03-24", "2020-03-25", "2020-03-26", "2020-03-27", "2020-03-28", "2020-03-29", "2020-03-30", "2020-03-31", "2020-04-01", "2020-04-02", "2020-04-03", "2020-04-04", "2020-04-05", "2020-04-06", "2020-04-07", "2020-04-08", "2020-04-09", "2020-04-10", "2020-04-11", "2020-04-12", "2020-04-13", "2020-04-14", "2020-04-15", "2020-04-16", "2020-04-17", "2020-04-18", "2020-04-19", "2020-04-20", "2020-04-21", "2020-04-22", "2020-04-23", "2020-04-24", "2020-04-25", "2020-04-26", "2020-04-27", "2020-04-28", "2020-04-29", "2020-04-30", "2020-05-01", "2020-05-02", "2020-05-03", "2020-05-04", "2020-05-05", "2020-05-06", "2020-05-07", "2020-05-08", "2020-05-09", "2020-05-10", "2020-05-11", "2020-05-12", "2020-05-13", "2020-05-14", "2020-05-15", "2020-05-16", "2020-05-17", "2020-05-18", "2020-05-19", "2020-05-20", "2020-05-21", "2020-05-22", "2020-05-23", "2020-05-24", "2020-05-25", "2020-05-26", "2020-05-27", "2020-05-28", "2020-05-29", "2020-05-30", "2020-05-31", "2020-06-01", "2020-06-02", "2020-06-03", "2020-06-04", "2020-06-05", "2020-06-06", "2020-06-07", "2020-06-08", "2020-06-09", "2020-06-10", "2020-06-11", "2020-06-12", "2020-06-13", "2020-06-14", "2020-06-15", "2020-06-16", "2020-06-17", "2020-06-18", "2020-06-19", "2020-06-20", "2020-06-21", "2020-06-22", "2020-06-23", "2020-06-24", "2020-06-25", "2020-06-26", "2020-06-27", "2020-06-28", "2020-06-29", "2020-06-30", "2020-07-01", "2020-07-02", "2020-07-03", "2020-07-04", "2020-07-05", "2020-07-06", "2020-07-07", "2020-07-08", "2020-07-09", "2020-07-10", "2020-07-11", "2020-07-12", "2020-07-13", "2020-07-14", "2020-07-15", "2020-07-16", "2020-07-17", "2020-07-18", "2020-07-19", "2020-07-20", "2020-07-21", "2020-07-22", "2020-07-23", "2020-07-24", "2020-07-25", "2020-07-26", "2020-07-27", "2020-07-28", "2020-07-29", "2020-07-30", "2020-07-31", "2020-08-01", "2020-08-02", "2020-08-03", "2020-08-04", "2020-08-05", "2020-08-06", "2020-08-07", "2020-08-08", "2020-08-09", "2020-08-10", "2020-08-11", "2020-08-12", "2020-08-13", "2020-08-14", "2020-08-15", "2020-08-16", "2020-08-17", "2020-08-18", "2020-08-19", "2020-08-20", "2020-08-21", "2020-08-22", "2020-08-23", "2020-08-24", "2020-08-25", "2020-08-26", "2020-08-27", "2020-08-28", "2020-08-29", "2020-08-30", "2020-08-31", "2020-09-01", "2020-09-02", "2020-09-03", "2020-09-04", "2020-09-05", "2020-09-06", "2020-09-07", "2020-09-08", "2020-09-09", "2020-09-10", "2020-09-11", "2020-09-12", "2020-09-13", "2020-09-14", "2020-09-15", "2020-09-16", "2020-09-17", "2020-09-18", "2020-09-19", "2020-09-20", "2020-09-21", "2020-09-22", "2020-09-23", "2020-09-24", "2020-09-25", "2020-09-26", "2020-09-27", "2020-09-28", "2020-09-29", "2020-09-30", "2020-10-01", "2020-10-02", "2020-10-03", "2020-10-04", "2020-10-05", "2020-10-06", "2020-10-07", "2020-10-08", "2020-10-09", "2020-10-10", "2020-10-11", "2020-10-12", "2020-10-13", "2020-10-14", "2020-10-15", "2020-10-16", "2020-10-17", "2020-10-18", "2020-10-19", "2020-10-20", "2020-10-21", "2020-10-22", "2020-10-23", "2020-10-24", "2020-10-25", "2020-10-26", "2020-10-27", "2020-10-28", "2020-10-29", "2020-10-30", "2020-10-31", "2020-11-01", "2020-11-02", "2020-11-03", "2020-11-04", "2020-11-05", "2020-11-06", "2020-11-07", "2020-11-08", "2020-11-09", "2020-11-10", "2020-11-11", "2020-11-12", "2020-11-13", "2020-11-14", "2020-11-15", "2020-11-16", "2020-11-17", "2020-11-18", "2020-11-19", "2020-11-20", "2020-11-21", "2020-11-22", "2020-11-23", "2020-11-24", "2020-11-25", "2020-11-26", "2020-11-27", "2020-11-28", "2020-11-29", "2020-11-30", "2020-12-01", "2020-12-02", "2020-12-03", "2020-12-04", "2020-12-05", "2020-12-06", "2020-12-07", "2020-12-08", "2020-12-09", "2020-12-10", "2020-12-11", "2020-12-12", "2020-12-13", "2020-12-14", "2020-12-15", "2020-12-16", "2020-12-17", "2020-12-18", "2020-12-19", "2020-12-20", "2020-12-21", "2020-12-22", "2020-12-23", "2020-12-24", "2020-12-25", "2020-12-26", "2020-12-27", "2020-12-28", "2020-12-29", "2020-12-30", "2020-12-31", "2021-01-01", "2021-01-02", "2021-01-03", "2021-01-04", "2021-01-05", "2021-01-06", "2021-01-07", "2021-01-08", "2021-01-09", "2021-01-10", "2021-01-11", "2021-01-12", "2021-01-13", "2021-01-14", "2021-01-15", "2021-01-16", "2021-01-17", "2021-01-18", "2021-01-19", "2021-01-20", "2021-01-21", "2021-01-22", "2021-01-23", "2021-01-24", "2021-01-25", "2021-01-26", "2021-01-27", "2021-01-28", "2021-01-29", "2021-01-30", "2021-01-31", "2021-02-01", "2021-02-02", "2021-02-03", "2021-02-04", "2021-02-05", "2021-02-06", "2021-02-07", "2021-02-08", "2021-02-09", "2021-02-10", "2021-02-11", "2021-02-12", "2021-02-13", "2021-02-14", "2021-02-15", "2021-02-16", "2021-02-17", "2021-02-18", "2021-02-19", "2021-02-20", "2021-02-21", "2021-02-22", "2021-02-23", "2021-02-24", "2021-02-25", "2021-02-26", "2021-02-27", "2021-02-28", "2021-03-01", "2021-03-02", "2021-03-03", "2021-03-04", "2021-03-05", "2021-03-06", "2021-03-07", "2021-03-08", "2021-03-09", "2021-03-10", "2021-03-11", "2021-03-12", "2021-03-13", "2021-03-14", "2021-03-15", "2021-03-16", "2021-03-17", "2021-03-18", "2021-03-19", "2021-03-20", "2021-03-21", "2021-03-22", "2021-03-23", "2021-03-24", "2021-03-25", "2021-03-26", "2021-03-27", "2021-03-28", "2021-03-29", "2021-03-30", "2021-03-31", "2021-04-01", "2021-04-02", "2021-04-03", "2021-04-04", "2021-04-05", "2021-04-06", "2021-04-07", "2021-04-08", "2021-04-09", "2021-04-10", "2021-04-11", "2021-04-12", "2021-04-13", "2021-04-14", "2021-04-15", "2021-04-16", "2021-04-17", "2021-04-18", "2021-04-19", "2021-04-20", "2021-04-21", "2021-04-22", "2021-04-23", "2021-04-24", "2021-04-25", "2021-04-26", "2021-04-27", "2021-04-28", "2021-04-29", "2021-04-30", "2021-05-01", "2021-05-02", "2021-05-03", "2021-05-04", "2021-05-05", "2021-05-06", "2021-05-07", "2021-05-08", "2021-05-09", "2021-05-10", "2021-05-11", "2021-05-12", "2021-05-13", "2021-05-14", "2021-05-15", "2021-05-16", "2021-05-17", "2021-05-18", "2021-05-19", "2021-05-20", "2021-05-21", "2021-05-22", "2021-05-23", "2021-05-24", "2021-05-25", "2021-05-26", "2021-05-27", "2021-05-28", "2021-05-29", "2021-05-30", "2021-05-31", "2021-06-01", "2021-06-02", "2021-06-03", "2021-06-04", "2021-06-05", "2021-06-06", "2021-06-07", "2021-06-08", "2021-06-09", "2021-06-10", "2021-06-11", "2021-06-12", "2021-06-13", "2021-06-14", "2021-06-15", "2021-06-16", "2021-06-17", "2021-06-18", "2021-06-19", "2021-06-20", "2021-06-21", "2021-06-22", "2021-06-23", "2021-06-24", "2021-06-25", "2021-06-26", "2021-06-27", "2021-06-28", "2021-06-29", "2021-06-30", "2021-07-01", "2021-07-02", "2021-07-03", "2021-07-04", "2021-07-05", "2021-07-06", "2021-07-07", "2021-07-08", "2021-07-09", "2021-07-10", "2021-07-11", "2021-07-12", "2021-07-13", "2021-07-14", "2021-07-15", "2021-07-16", "2021-07-17", "2021-07-18", "2021-07-19", "2021-07-20", "2021-07-21", "2021-07-22", "2021-07-23", "2021-07-24", "2021-07-25", "2021-07-26", "2021-07-27", "2021-07-28", "2021-07-29", "2021-07-30", "2021-07-31", "2021-08-01", "2021-08-02", "2021-08-03", "2021-08-04", "2021-08-05", "2021-08-06", "2021-08-07", "2021-08-08", "2021-08-09", "2021-08-10", "2021-08-11", "2021-08-12", "2021-08-13", "2021-08-14", "2021-08-15", "2021-08-16", "2021-08-17", "2021-08-18", "2021-08-19", "2021-08-20", "2021-08-21", "2021-08-22", "2021-08-23", "2021-08-24", "2021-08-25", "2021-08-26", "2021-08-27", "2021-08-28", "2021-08-29", "2021-08-30", "2021-08-31", "2021-09-01", "2021-09-02", "2021-09-03", "2021-09-04", "2021-09-05", "2021-09-06", "2021-09-07", "2021-09-08", "2021-09-09", "2021-09-10", "2021-09-11", "2021-09-12", "2021-09-13", "2021-09-14", "2021-09-15", "2021-09-16", "2021-09-17", "2021-09-18", "2021-09-19", "2021-09-20", "2021-09-21", "2021-09-22", "2021-09-23", "2021-09-24", "2021-09-25", "2021-09-26", "2021-09-27", "2021-09-28", "2021-09-29", "2021-09-30", "2021-10-01", "2021-10-02", "2021-10-03", "2021-10-04", "2021-10-05", "2021-10-06", "2021-10-07", "2021-10-08", "2021-10-09", "2021-10-10", "2021-10-11", "2021-10-12", "2021-10-13", "2021-10-14", "2021-10-15", "2021-10-16", "2021-10-17", "2021-10-18", "2021-10-19", "2021-10-20", "2021-10-21", "2021-10-22", "2021-10-23", "2021-10-24", "2021-10-25", "2021-10-26", "2021-10-27", "2021-10-28", "2021-10-29", "2021-10-30", "2021-10-31", "2021-11-01", "2021-11-02", "2021-11-03", "2021-11-04", "2021-11-05", "2021-11-06", "2021-11-07", "2021-11-08", "2021-11-09", "2021-11-10", "2021-11-11", "2021-11-12", "2021-11-13", "2021-11-14", "2021-11-15", "2021-11-16", "2021-11-17", "2021-11-18", "2021-11-19", "2021-11-20", "2021-11-21", "2021-11-22", "2021-11-23", "2021-11-24", "2021-11-25", "2021-11-26", "2021-11-27", "2021-11-28", "2021-11-29", "2021-11-30", "2021-12-01", "2021-12-02", "2021-12-03", "2021-12-04", "2021-12-05", "2021-12-06", "2021-12-07", "2021-12-08", "2021-12-09", "2021-12-10", "2021-12-11", "2021-12-12", "2021-12-13", "2021-12-14", "2021-12-15", "2021-12-16", "2021-12-17", "2021-12-18", "2021-12-19", "2021-12-20" ], "y": [ 100.0, 100.56, 99.02, 98.61, 98.61, 94.05, 94.61, 95.18, 95.74, 98.74, 98.68, 100.2, 100.46, 100.54, 100.61, 100.68, 99.76, 98.69, 95.56, 91.14, 90.54, 89.94, 89.34, 91.69, 88.83, 88.9, 89.23, 90.89, 92.56, 94.22, 99.82, 98.15, 99.22, 97.64, 97.6, 97.56, 97.53, 95.21, 94.89, 97.75, 98.23, 99.1, 99.97, 100.83, 100.1, 100.14, 104.39, 104.52, 104.65, 104.78, 104.91, 105.63, 103.85, 103.44, 101.57, 101.82, 102.06, 102.31, 100.91, 103.94, 104.22, 103.63, 103.4, 103.16, 102.93, 102.85, 102.42, 101.27, 101.89, 102.13, 102.38, 102.63, 102.48, 101.27, 103.53, 102.81, 102.52, 102.23, 101.93, 102.48, 103.05, 104.51, 105.43, 104.99, 104.56, 104.13, 104.87, 105.26, 103.45, 104.3, 103.85, 103.4, 102.95, 102.51, 102.84, 103.02, 104.44, 104.45, 104.47, 104.49, 103.73, 102.08, 103.35, 100.79, 101.23, 101.67, 102.11, 103.1, 103.02, 104.14, 103.98, 103.8, 103.62, 103.44, 104.0, 103.97, 103.71, 104.98, 105.19, 105.41, 105.63, 106.55, 106.17, 105.95, 106.58, 106.62, 106.67, 106.71, 107.81, 106.62, 107.27, 107.34, 107.4, 107.47, 107.54, 108.48, 109.16, 108.18, 108.12, 108.38, 108.63, 108.89, 108.87, 108.91, 108.15, 108.73, 108.88, 109.03, 109.19, 110.78, 112.08, 113.59, 114.08, 114.76, 115.43, 116.11, 116.93, 117.46, 116.79, 118.02, 118.08, 118.15, 118.21, 120.33, 122.12, 123.35, 120.86, 121.15, 121.44, 121.72, 116.2, 116.34, 117.65, 116.47, 117.43, 118.39, 119.35, 120.22, 117.77, 116.27, 116.32, 116.18, 116.05, 115.91, 114.95, 116.69, 115.54, 118.13, 118.19, 118.25, 118.31, 118.34, 116.31, 115.9, 115.68, 115.82, 115.95, 116.09, 116.23, 116.93, 117.5, 116.52, 116.82, 117.13, 117.43, 117.63, 117.86, 116.65, 117.37, 116.35, 115.33, 114.31, 114.16, 111.83, 112.34, 111.7, 112.0, 112.3, 112.61, 113.9, 113.49, 114.75, 114.25, 114.5, 114.75, 114.99, 114.31, 113.26, 113.56, 115.41, 115.47, 115.53, 115.6, 113.55, 114.32, 114.43, 114.29, 114.4, 114.51, 114.63, 114.87, 115.72, 114.31, 114.36, 114.38, 114.39, 114.4, 114.77, 112.81, 112.17, 112.88, 113.14, 113.4, 113.66, 114.75, 113.92, 116.97, 117.27, 115.32, 113.37, 111.43, 112.76, 111.88, 112.59, 113.38, 113.41, 113.45, 113.48, 113.31, 112.65, 111.9, 112.59, 111.9, 111.2, 110.5, 108.52, 108.57, 107.86, 107.14, 107.02, 106.89, 106.77, 109.08, 109.77, 110.44, 110.39, 110.91, 111.43, 111.95, 112.49, 110.31, 110.25, 110.62, 110.4, 110.18, 109.96, 111.37, 111.6, 113.47, 113.38, 113.25, 113.12, 112.99, 112.23, 112.72, 113.03, 112.99, 112.95, 112.91, 112.87, 113.02, 113.7, 113.83, 114.6, 115.38, 116.15, 116.93, 117.41, 114.66, 114.98, 110.28, 110.59, 110.9, 111.21, 110.81, 111.45, 111.25, 109.99, 110.14, 110.3, 110.45, 110.6, 112.19, 112.16, 111.58, 111.56, 111.55, 111.53, 111.28, 110.93, 110.51, 111.07, 111.34, 111.61, 111.89, 110.06, 110.17, 107.56, 108.88, 109.31, 109.73, 110.15, 110.35, 110.67, 109.73, 109.53, 109.16, 108.79, 108.43, 108.06, 106.49, 106.63, 106.77, 107.39, 108.01, 108.63, 108.49, 108.01, 106.69, 103.91, 103.79, 103.68, 103.57, 104.21, 103.14, 102.23, 102.1, 101.69, 101.28, 100.88, 103.21, 103.51, 103.56, 103.39, 103.58, 103.77, 103.95, 104.06, 103.83, 104.15, 104.71, 104.63, 104.56, 104.49, 103.7, 104.19, 103.71, 104.15, 103.75, 103.35, 102.94, 101.25, 103.05, 103.81, 103.82, 103.83, 103.83, 103.84, 104.71, 104.63, 105.63, 104.82, 104.58, 104.34, 104.09, 104.99, 104.32, 106.15, 106.97, 106.77, 106.58, 106.39, 106.86, 107.77, 107.1, 106.85, 106.89, 106.93, 106.98, 106.91, 106.62, 106.31, 106.26, 106.75, 107.23, 107.71, 106.77, 107.27, 109.16, 110.1, 110.23, 110.36, 110.48, 110.39, 109.59, 109.66, 110.51, 111.1, 111.69, 112.29, 112.31, 113.12, 113.15, 112.84, 113.0, 113.16, 113.32, 114.13, 114.32, 113.98, 114.39, 114.4, 114.4, 114.41, 114.42, 114.69, 112.51, 113.63, 113.77, 113.91, 114.05, 113.77, 113.83, 113.89, 112.88, 112.61, 112.35, 112.08, 111.51, 111.81, 106.65, 106.3, 106.58, 106.86, 107.14, 106.8, 107.17, 106.76, 106.82, 106.88, 106.94, 107.0, 105.99, 106.47, 106.78, 107.18, 107.35, 107.51, 107.67, 107.84, 108.32, 108.21, 108.83, 108.74, 108.65, 108.56, 108.79, 109.69, 109.94, 109.1, 108.99, 108.87, 108.75, 108.88, 108.4, 108.53, 108.31, 108.26, 108.21, 108.15, 108.2, 108.2, 110.11, 108.99, 109.1, 109.21, 109.32, 108.84, 108.86, 108.54, 105.82, 105.09, 104.36, 103.62, 103.95, 105.25, 105.16, 106.74, 106.97, 107.21, 107.44, 107.33, 107.12, 107.04, 107.09, 107.53, 107.98, 108.42, 108.57, 107.52, 107.76, 109.23, 109.08, 108.92, 108.77, 109.13, 109.02, 108.75, 110.09, 109.56, 109.04, 108.51, 107.98, 107.67, 108.07, 107.6, 107.65, 107.7, 107.75, 108.51, 107.77, 105.5, 105.19, 105.44, 105.68, 105.93, 106.79, 106.83, 105.08, 105.21, 105.21, 105.22, 105.22, 104.37, 103.51, 105.54, 105.64, 105.83, 106.01, 106.2, 105.8, 105.85, 105.7, 105.6, 105.57, 105.53, 105.5, 105.72, 107.85, 108.03, 106.26, 106.21, 106.16, 106.11, 106.41, 107.27, 107.1, 107.96, 108.17, 108.38, 108.59, 107.79, 108.1, 108.33, 107.21, 107.45, 107.69, 107.93, 107.55, 106.04, 107.81, 109.22, 109.44, 109.66, 109.88, 110.05, 111.09, 112.03, 112.31, 112.28, 112.24, 112.2, 111.45, 112.42, 111.9, 111.31, 110.4, 109.5, 108.59, 107.24, 107.27, 107.71, 107.35, 107.29, 107.23, 107.17, 106.64, 107.12, 105.87, 107.15, 107.06, 106.97, 106.88, 107.18, 107.23, 106.7, 107.2, 107.27, 107.34, 107.41, 106.45, 105.98, 108.03, 108.46, 108.26, 108.05, 107.85 ], "yaxis": "y2", "type": "scatter" } ], "layout": { "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ], "sequentialminus": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "yaxis": { "title": { "text": "Total Cases" }, "rangemode": "tozero" }, "yaxis2": { "title": { "text": "%" }, "rangemode": "tozero", "overlaying": "y", "side": "right" }, "legend": { "x": 1.08 }, "margin": { "t": 24, "b": 0 }, "paper_bgcolor": "rgba(0, 0, 0, 0)" } } ) }; ================================================ FILE: web/covid_deaths.js ================================================ window.PLOTLYENV=window.PLOTLYENV || {}; if (document.getElementById("2a950764-39fc-416d-97fe-0a6226a3095f")) { Plotly.newPlot( '2a950764-39fc-416d-97fe-0a6226a3095f', { "data": [ { "hovertemplate": "Continent=South America
    Date=%{x}
    Total Deaths per Million=%{y}", "legendgroup": "South America", "line": { "color": "#636efa", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "South America", "showlegend": true, "x": [ "2020-02-23", "2020-02-24", "2020-02-25", "2020-02-26", "2020-02-27", "2020-02-28", "2020-02-29", "2020-03-01", "2020-03-02", "2020-03-03", "2020-03-04", "2020-03-05", "2020-03-06", "2020-03-07", "2020-03-08", "2020-03-09", "2020-03-10", "2020-03-11", "2020-03-12", "2020-03-13", "2020-03-14", "2020-03-15", "2020-03-16", "2020-03-17", "2020-03-18", "2020-03-19", "2020-03-20", "2020-03-21", "2020-03-22", "2020-03-23", "2020-03-24", "2020-03-25", "2020-03-26", "2020-03-27", "2020-03-28", "2020-03-29", "2020-03-30", "2020-03-31", "2020-04-01", "2020-04-02", "2020-04-03", "2020-04-04", "2020-04-05", "2020-04-06", "2020-04-07", "2020-04-08", "2020-04-09", "2020-04-10", "2020-04-11", "2020-04-12", "2020-04-13", "2020-04-14", "2020-04-15", "2020-04-16", "2020-04-17", "2020-04-18", "2020-04-19", "2020-04-20", "2020-04-21", "2020-04-22", "2020-04-23", "2020-04-24", "2020-04-25", "2020-04-26", "2020-04-27", "2020-04-28", "2020-04-29", "2020-04-30", "2020-05-01", "2020-05-02", "2020-05-03", "2020-05-04", "2020-05-05", "2020-05-06", "2020-05-07", "2020-05-08", "2020-05-09", "2020-05-10", "2020-05-11", "2020-05-12", "2020-05-13", "2020-05-14", "2020-05-15", "2020-05-16", "2020-05-17", "2020-05-18", "2020-05-19", "2020-05-20", "2020-05-21", "2020-05-22", "2020-05-23", "2020-05-24", "2020-05-25", "2020-05-26", "2020-05-27", "2020-05-28", "2020-05-29", "2020-05-30", "2020-05-31", "2020-06-01", "2020-06-02", "2020-06-03", "2020-06-04", "2020-06-05", "2020-06-06", "2020-06-07", "2020-06-08", "2020-06-09", "2020-06-10", "2020-06-11", "2020-06-12", "2020-06-13", "2020-06-14", "2020-06-15", "2020-06-16", "2020-06-17", "2020-06-18", "2020-06-19", "2020-06-20", "2020-06-21", "2020-06-22", "2020-06-23", "2020-06-24", "2020-06-25", "2020-06-26", "2020-06-27", "2020-06-28", "2020-06-29", "2020-06-30", "2020-07-01", "2020-07-02", "2020-07-03", "2020-07-04", "2020-07-05", "2020-07-06", "2020-07-07", "2020-07-08", "2020-07-09", "2020-07-10", "2020-07-11", "2020-07-12", "2020-07-13", "2020-07-14", "2020-07-15", "2020-07-16", "2020-07-17", "2020-07-18", "2020-07-19", "2020-07-20", "2020-07-21", "2020-07-22", "2020-07-23", "2020-07-24", "2020-07-25", "2020-07-26", "2020-07-27", "2020-07-28", "2020-07-29", "2020-07-30", "2020-07-31", "2020-08-01", "2020-08-02", "2020-08-03", "2020-08-04", "2020-08-05", "2020-08-06", "2020-08-07", "2020-08-08", "2020-08-09", "2020-08-10", "2020-08-11", "2020-08-12", "2020-08-13", "2020-08-14", "2020-08-15", "2020-08-16", "2020-08-17", "2020-08-18", "2020-08-19", "2020-08-20", "2020-08-21", "2020-08-22", "2020-08-23", "2020-08-24", "2020-08-25", "2020-08-26", "2020-08-27", "2020-08-28", "2020-08-29", "2020-08-30", "2020-08-31", "2020-09-01", "2020-09-02", "2020-09-03", "2020-09-04", "2020-09-05", "2020-09-06", "2020-09-07", "2020-09-08", "2020-09-09", "2020-09-10", "2020-09-11", "2020-09-12", "2020-09-13", "2020-09-14", "2020-09-15", "2020-09-16", "2020-09-17", "2020-09-18", "2020-09-19", "2020-09-20", "2020-09-21", "2020-09-22", "2020-09-23", "2020-09-24", "2020-09-25", "2020-09-26", "2020-09-27", "2020-09-28", "2020-09-29", "2020-09-30", "2020-10-01", "2020-10-02", "2020-10-03", "2020-10-04", "2020-10-05", "2020-10-06", "2020-10-07", "2020-10-08", "2020-10-09", "2020-10-10", "2020-10-11", "2020-10-12", "2020-10-13", "2020-10-14", "2020-10-15", "2020-10-16", "2020-10-17", "2020-10-18", "2020-10-19", "2020-10-20", "2020-10-21", "2020-10-22", "2020-10-23", "2020-10-24", "2020-10-25", "2020-10-26", "2020-10-27", "2020-10-28", "2020-10-29", "2020-10-30", "2020-10-31", "2020-11-01", "2020-11-02", "2020-11-03", "2020-11-04", "2020-11-05", "2020-11-06", "2020-11-07", "2020-11-08", "2020-11-09", "2020-11-10", "2020-11-11", "2020-11-12", "2020-11-13", "2020-11-14", "2020-11-15", "2020-11-16", "2020-11-17", "2020-11-18", "2020-11-19", "2020-11-20", "2020-11-21", "2020-11-22", "2020-11-23", "2020-11-24", "2020-11-25", "2020-11-26", "2020-11-27", "2020-11-28", "2020-11-29", "2020-11-30", "2020-12-01", "2020-12-02", "2020-12-03", "2020-12-04", "2020-12-05", "2020-12-06", "2020-12-07", "2020-12-08", "2020-12-09", "2020-12-10", "2020-12-11", "2020-12-12", "2020-12-13", "2020-12-14", "2020-12-15", "2020-12-16", "2020-12-17", "2020-12-18", "2020-12-19", "2020-12-20", "2020-12-21", "2020-12-22", "2020-12-23", "2020-12-24", "2020-12-25", "2020-12-26", "2020-12-27", "2020-12-28", "2020-12-29", "2020-12-30", "2020-12-31", "2021-01-01", "2021-01-02", "2021-01-03", "2021-01-04", "2021-01-05", "2021-01-06", "2021-01-07", "2021-01-08", "2021-01-09", "2021-01-10", "2021-01-11", "2021-01-12", "2021-01-13", "2021-01-14", "2021-01-15", "2021-01-16", "2021-01-17", "2021-01-18", "2021-01-19", "2021-01-20", "2021-01-21", "2021-01-22", "2021-01-23", "2021-01-24", "2021-01-25", "2021-01-26", "2021-01-27", "2021-01-28", "2021-01-29", "2021-01-30", "2021-01-31", "2021-02-01", "2021-02-02", "2021-02-03", "2021-02-04", "2021-02-05", "2021-02-06", "2021-02-07", "2021-02-08", "2021-02-09", "2021-02-10", "2021-02-11", "2021-02-12", "2021-02-13", "2021-02-14", "2021-02-15", "2021-02-16", "2021-02-17", "2021-02-18", "2021-02-19", "2021-02-20", "2021-02-21", "2021-02-22", "2021-02-23", "2021-02-24", "2021-02-25", "2021-02-26", "2021-02-27", "2021-02-28", "2021-03-01", "2021-03-02", "2021-03-03", "2021-03-04", "2021-03-05", "2021-03-06", "2021-03-07", "2021-03-08", "2021-03-09", "2021-03-10", "2021-03-11", "2021-03-12", "2021-03-13", "2021-03-14", "2021-03-15", "2021-03-16", "2021-03-17", "2021-03-18", "2021-03-19", "2021-03-20", "2021-03-21", "2021-03-22", "2021-03-23", "2021-03-24", "2021-03-25", "2021-03-26", "2021-03-27", "2021-03-28", "2021-03-29", "2021-03-30", "2021-03-31", "2021-04-01", "2021-04-02", "2021-04-03", "2021-04-04", "2021-04-05", "2021-04-06", "2021-04-07", "2021-04-08", "2021-04-09", "2021-04-10", "2021-04-11", "2021-04-12", "2021-04-13", "2021-04-14", "2021-04-15", "2021-04-16", "2021-04-17", "2021-04-18", "2021-04-19", "2021-04-20", "2021-04-21", "2021-04-22", "2021-04-23", "2021-04-24", "2021-04-25", "2021-04-26", "2021-04-27", "2021-04-28", "2021-04-29", "2021-04-30", "2021-05-01", "2021-05-02", "2021-05-03", "2021-05-04", "2021-05-05", "2021-05-06", "2021-05-07", "2021-05-08", "2021-05-09", "2021-05-10", "2021-05-11", "2021-05-12", "2021-05-13", "2021-05-14", "2021-05-15", "2021-05-16", "2021-05-17", "2021-05-18", "2021-05-19", "2021-05-20", "2021-05-21", "2021-05-22", "2021-05-23", "2021-05-24", "2021-05-25", "2021-05-26", "2021-05-27", "2021-05-28", "2021-05-29", "2021-05-30", "2021-05-31", "2021-06-01", "2021-06-02", "2021-06-03", "2021-06-04", "2021-06-05", "2021-06-06", "2021-06-07", "2021-06-08", "2021-06-09", "2021-06-10", "2021-06-11", "2021-06-12", "2021-06-13", "2021-06-14", "2021-06-15", "2021-06-16", "2021-06-17", "2021-06-18", "2021-06-19", "2021-06-20", "2021-06-21", "2021-06-22", "2021-06-23", "2021-06-24", "2021-06-25", "2021-06-26", "2021-06-27", "2021-06-28", "2021-06-29", "2021-06-30", "2021-07-01", "2021-07-02", "2021-07-03", "2021-07-04", "2021-07-05", "2021-07-06", "2021-07-07", "2021-07-08", "2021-07-09", "2021-07-10", "2021-07-11", "2021-07-12", "2021-07-13", "2021-07-14", "2021-07-15", "2021-07-16", "2021-07-17", "2021-07-18", "2021-07-19", "2021-07-20", "2021-07-21", "2021-07-22", "2021-07-23", "2021-07-24", "2021-07-25", "2021-07-26", "2021-07-27", "2021-07-28", "2021-07-29", "2021-07-30", "2021-07-31", "2021-08-01", "2021-08-02", "2021-08-03", "2021-08-04", "2021-08-05", "2021-08-06", "2021-08-07", "2021-08-08", "2021-08-09", "2021-08-10", "2021-08-11", "2021-08-12", "2021-08-13", "2021-08-14", "2021-08-15", "2021-08-16", "2021-08-17", "2021-08-18", "2021-08-19", "2021-08-20", "2021-08-21", "2021-08-22", "2021-08-23", "2021-08-24", "2021-08-25", "2021-08-26", "2021-08-27", "2021-08-28", "2021-08-29", "2021-08-30", "2021-08-31", "2021-09-01", "2021-09-02", "2021-09-03", "2021-09-04", "2021-09-05", "2021-09-06", "2021-09-07", "2021-09-08", "2021-09-09", "2021-09-10", "2021-09-11", "2021-09-12", "2021-09-13", "2021-09-14", "2021-09-15", "2021-09-16", "2021-09-17", "2021-09-18", "2021-09-19", "2021-09-20", "2021-09-21", "2021-09-22", "2021-09-23", "2021-09-24", "2021-09-25", "2021-09-26", "2021-09-27", "2021-09-28", "2021-09-29", "2021-09-30", "2021-10-01", "2021-10-02", "2021-10-03", "2021-10-04", "2021-10-05", "2021-10-06", "2021-10-07", "2021-10-08", "2021-10-09", "2021-10-10", "2021-10-11", "2021-10-12", "2021-10-13", "2021-10-14", "2021-10-15", "2021-10-16", "2021-10-17", "2021-10-18", "2021-10-19", "2021-10-20", "2021-10-21", "2021-10-22", "2021-10-23", "2021-10-24", "2021-10-25", "2021-10-26", "2021-10-27", "2021-10-28", "2021-10-29", "2021-10-30", "2021-10-31", "2021-11-01", "2021-11-02", "2021-11-03", "2021-11-04", "2021-11-05", "2021-11-06", "2021-11-07", "2021-11-08", "2021-11-09", "2021-11-10", "2021-11-11", "2021-11-12", "2021-11-13", "2021-11-14", "2021-11-15", "2021-11-16", "2021-11-17", "2021-11-18", "2021-11-19", "2021-11-20", "2021-11-21", "2021-11-22", "2021-11-23", "2021-11-24", "2021-11-25", "2021-11-26", "2021-11-27", "2021-11-28", "2021-11-29", "2021-11-30", "2021-12-01", "2021-12-02", "2021-12-03", "2021-12-04", "2021-12-05", "2021-12-06", "2021-12-07", "2021-12-08", "2021-12-09", "2021-12-10", "2021-12-11", "2021-12-12", "2021-12-13", "2021-12-14", "2021-12-15", "2021-12-16", "2021-12-17", "2021-12-18", "2021-12-19", "2021-12-20" ], "xaxis": "x", "y": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 3.0, 3.0, 3.0, 4.0, 5.0, 5.0, 6.0, 6.0, 7.0, 8.0, 9.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 17.0, 18.0, 20.0, 21.0, 23.0, 25.0, 27.0, 29.0, 31.0, 34.0, 36.0, 38.0, 40.0, 43.0, 46.0, 49.0, 51.0, 55.0, 57.0, 61.0, 64.0, 67.0, 71.0, 74.0, 77.0, 80.0, 84.0, 88.0, 92.0, 96.0, 100.0, 103.0, 106.0, 110.0, 115.0, 119.0, 123.0, 127.0, 130.0, 133.0, 138.0, 143.0, 148.0, 152.0, 156.0, 159.0, 164.0, 168.0, 173.0, 178.0, 183.0, 187.0, 191.0, 194.0, 199.0, 204.0, 209.0, 214.0, 219.0, 223.0, 226.0, 231.0, 235.0, 240.0, 245.0, 250.0, 253.0, 257.0, 262.0, 266.0, 272.0, 277.0, 282.0, 285.0, 289.0, 294.0, 299.0, 304.0, 309.0, 314.0, 318.0, 321.0, 327.0, 332.0, 337.0, 345.0, 351.0, 355.0, 358.0, 363.0, 368.0, 374.0, 380.0, 385.0, 389.0, 393.0, 398.0, 405.0, 410.0, 416.0, 421.0, 425.0, 429.0, 435.0, 441.0, 447.0, 453.0, 457.0, 461.0, 466.0, 472.0, 477.0, 483.0, 489.0, 493.0, 497.0, 501.0, 507.0, 513.0, 519.0, 524.0, 529.0, 533.0, 537.0, 543.0, 548.0, 553.0, 558.0, 562.0, 566.0, 569.0, 575.0, 580.0, 585.0, 589.0, 593.0, 596.0, 611.0, 615.0, 619.0, 624.0, 628.0, 632.0, 635.0, 638.0, 642.0, 646.0, 650.0, 654.0, 658.0, 660.0, 663.0, 667.0, 670.0, 676.0, 680.0, 684.0, 687.0, 689.0, 693.0, 698.0, 708.0, 711.0, 715.0, 718.0, 721.0, 724.0, 728.0, 732.0, 737.0, 740.0, 742.0, 744.0, 747.0, 750.0, 754.0, 757.0, 760.0, 762.0, 765.0, 768.0, 771.0, 775.0, 778.0, 780.0, 782.0, 785.0, 788.0, 791.0, 794.0, 797.0, 799.0, 801.0, 803.0, 805.0, 809.0, 810.0, 814.0, 816.0, 818.0, 820.0, 822.0, 825.0, 828.0, 831.0, 834.0, 836.0, 838.0, 841.0, 844.0, 847.0, 850.0, 852.0, 853.0, 855.0, 858.0, 861.0, 864.0, 867.0, 869.0, 871.0, 873.0, 876.0, 879.0, 882.0, 885.0, 888.0, 890.0, 892.0, 895.0, 898.0, 901.0, 904.0, 906.0, 908.0, 910.0, 914.0, 917.0, 921.0, 924.0, 927.0, 929.0, 932.0, 936.0, 939.0, 942.0, 944.0, 946.0, 949.0, 951.0, 955.0, 959.0, 963.0, 966.0, 968.0, 970.0, 973.0, 977.0, 982.0, 987.0, 991.0, 996.0, 999.0, 1002.0, 1006.0, 1011.0, 1016.0, 1021.0, 1026.0, 1029.0, 1033.0, 1038.0, 1044.0, 1050.0, 1055.0, 1061.0, 1065.0, 1069.0, 1076.0, 1081.0, 1087.0, 1093.0, 1099.0, 1103.0, 1107.0, 1113.0, 1119.0, 1124.0, 1130.0, 1133.0, 1139.0, 1142.0, 1150.0, 1155.0, 1162.0, 1168.0, 1173.0, 1177.0, 1181.0, 1186.0, 1192.0, 1198.0, 1204.0, 1209.0, 1214.0, 1217.0, 1223.0, 1229.0, 1235.0, 1241.0, 1247.0, 1251.0, 1255.0, 1261.0, 1268.0, 1275.0, 1282.0, 1287.0, 1292.0, 1296.0, 1304.0, 1311.0, 1318.0, 1326.0, 1333.0, 1338.0, 1343.0, 1352.0, 1361.0, 1369.0, 1379.0, 1387.0, 1392.0, 1397.0, 1408.0, 1415.0, 1424.0, 1435.0, 1446.0, 1453.0, 1460.0, 1471.0, 1483.0, 1495.0, 1504.0, 1512.0, 1518.0, 1524.0, 1537.0, 1549.0, 1562.0, 1575.0, 1585.0, 1593.0, 1600.0, 1613.0, 1625.0, 1637.0, 1649.0, 1660.0, 1667.0, 1674.0, 1686.0, 1698.0, 1708.0, 1721.0, 1731.0, 1739.0, 1746.0, 1758.0, 1770.0, 1782.0, 1792.0, 1802.0, 1808.0, 1816.0, 1827.0, 1838.0, 1849.0, 1858.0, 1868.0, 1874.0, 1880.0, 1890.0, 1900.0, 1910.0, 1920.0, 1929.0, 1935.0, 1942.0, 1951.0, 1962.0, 1972.0, 1982.0, 1991.0, 1997.0, 2002.0, 2012.0, 2021.0, 2031.0, 2040.0, 2049.0, 2055.0, 2062.0, 2071.0, 2083.0, 2090.0, 2099.0, 2107.0, 2112.0, 2119.0, 2129.0, 2139.0, 2151.0, 2160.0, 2168.0, 2175.0, 2181.0, 2192.0, 2202.0, 2213.0, 2222.0, 2231.0, 2237.0, 2243.0, 2252.0, 2262.0, 2271.0, 2280.0, 2287.0, 2292.0, 2298.0, 2306.0, 2315.0, 2324.0, 2332.0, 2339.0, 2345.0, 2350.0, 2357.0, 2365.0, 2372.0, 2378.0, 2382.0, 2388.0, 2393.0, 2400.0, 2406.0, 2413.0, 2419.0, 2424.0, 2428.0, 2432.0, 2458.0, 2464.0, 2469.0, 2475.0, 2479.0, 2482.0, 2486.0, 2491.0, 2496.0, 2503.0, 2507.0, 2511.0, 2514.0, 2516.0, 2521.0, 2526.0, 2530.0, 2534.0, 2537.0, 2539.0, 2542.0, 2546.0, 2550.0, 2554.0, 2558.0, 2561.0, 2562.0, 2564.0, 2568.0, 2572.0, 2575.0, 2578.0, 2581.0, 2582.0, 2585.0, 2588.0, 2591.0, 2594.0, 2596.0, 2599.0, 2600.0, 2602.0, 2604.0, 2607.0, 2610.0, 2613.0, 2615.0, 2616.0, 2617.0, 2619.0, 2620.0, 2623.0, 2625.0, 2627.0, 2629.0, 2630.0, 2632.0, 2635.0, 2637.0, 2639.0, 2641.0, 2643.0, 2644.0, 2645.0, 2648.0, 2650.0, 2652.0, 2653.0, 2654.0, 2655.0, 2658.0, 2660.0, 2661.0, 2663.0, 2664.0, 2665.0, 2666.0, 2668.0, 2670.0, 2671.0, 2673.0, 2674.0, 2675.0, 2675.0, 2676.0, 2677.0, 2679.0, 2680.0, 2681.0, 2682.0, 2683.0, 2684.0, 2685.0, 2687.0, 2688.0, 2689.0, 2690.0, 2690.0, 2692.0, 2693.0, 2694.0, 2695.0, 2696.0, 2697.0, 2697.0, 2698.0, 2698.0, 2700.0, 2701.0, 2702.0, 2702.0, 2703.0, 2704.0, 2705.0, 2705.0, 2706.0, 2708.0, 2709.0, 2709.0, 2710.0, 2711.0, 2712.0, 2713.0, 2714.0, 2715.0, 2715.0, 2716.0, 2717.0, 2718.0, 2719.0, 2720.0, 2721.0, 2722.0, 2723.0, 2724.0, 2725.0, 2726.0, 2727.0, 2727.0, 2728.0, 2729.0, 2730.0, 2731.0, 2731.0, 2732.0, 2732.0, 2733.0, 2734.0, 2735.0, 2736.0, 2737.0, 2737.0, 2739.0, 2739.0 ], "yaxis": "y", "type": "scattergl" }, { "hovertemplate": "Continent=North America
    Date=%{x}
    Total Deaths per Million=%{y}", "legendgroup": "North America", "line": { "color": "#EF553B", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "North America", "showlegend": true, "x": [ "2020-02-23", "2020-02-24", "2020-02-25", "2020-02-26", "2020-02-27", "2020-02-28", "2020-02-29", "2020-03-01", "2020-03-02", "2020-03-03", "2020-03-04", "2020-03-05", "2020-03-06", "2020-03-07", "2020-03-08", "2020-03-09", "2020-03-10", "2020-03-11", "2020-03-12", "2020-03-13", "2020-03-14", "2020-03-15", "2020-03-16", "2020-03-17", "2020-03-18", "2020-03-19", "2020-03-20", "2020-03-21", "2020-03-22", "2020-03-23", "2020-03-24", "2020-03-25", "2020-03-26", "2020-03-27", "2020-03-28", "2020-03-29", "2020-03-30", "2020-03-31", "2020-04-01", "2020-04-02", "2020-04-03", "2020-04-04", "2020-04-05", "2020-04-06", "2020-04-07", "2020-04-08", "2020-04-09", "2020-04-10", "2020-04-11", "2020-04-12", "2020-04-13", "2020-04-14", "2020-04-15", "2020-04-16", "2020-04-17", "2020-04-18", "2020-04-19", "2020-04-20", "2020-04-21", "2020-04-22", "2020-04-23", "2020-04-24", "2020-04-25", "2020-04-26", "2020-04-27", "2020-04-28", "2020-04-29", "2020-04-30", "2020-05-01", "2020-05-02", "2020-05-03", "2020-05-04", "2020-05-05", "2020-05-06", "2020-05-07", "2020-05-08", "2020-05-09", "2020-05-10", "2020-05-11", "2020-05-12", "2020-05-13", "2020-05-14", "2020-05-15", "2020-05-16", "2020-05-17", "2020-05-18", "2020-05-19", "2020-05-20", "2020-05-21", "2020-05-22", "2020-05-23", "2020-05-24", "2020-05-25", "2020-05-26", "2020-05-27", "2020-05-28", "2020-05-29", "2020-05-30", "2020-05-31", "2020-06-01", "2020-06-02", "2020-06-03", "2020-06-04", "2020-06-05", "2020-06-06", "2020-06-07", "2020-06-08", "2020-06-09", "2020-06-10", "2020-06-11", "2020-06-12", "2020-06-13", "2020-06-14", "2020-06-15", "2020-06-16", "2020-06-17", "2020-06-18", "2020-06-19", "2020-06-20", "2020-06-21", "2020-06-22", "2020-06-23", "2020-06-24", "2020-06-25", "2020-06-26", "2020-06-27", "2020-06-28", "2020-06-29", "2020-06-30", "2020-07-01", "2020-07-02", "2020-07-03", "2020-07-04", "2020-07-05", "2020-07-06", "2020-07-07", "2020-07-08", "2020-07-09", "2020-07-10", "2020-07-11", "2020-07-12", "2020-07-13", "2020-07-14", "2020-07-15", "2020-07-16", "2020-07-17", "2020-07-18", "2020-07-19", "2020-07-20", "2020-07-21", "2020-07-22", "2020-07-23", "2020-07-24", "2020-07-25", "2020-07-26", "2020-07-27", "2020-07-28", "2020-07-29", "2020-07-30", "2020-07-31", "2020-08-01", "2020-08-02", "2020-08-03", "2020-08-04", "2020-08-05", "2020-08-06", "2020-08-07", "2020-08-08", "2020-08-09", "2020-08-10", "2020-08-11", "2020-08-12", "2020-08-13", "2020-08-14", "2020-08-15", "2020-08-16", "2020-08-17", "2020-08-18", "2020-08-19", "2020-08-20", "2020-08-21", "2020-08-22", "2020-08-23", "2020-08-24", "2020-08-25", "2020-08-26", "2020-08-27", "2020-08-28", "2020-08-29", "2020-08-30", "2020-08-31", "2020-09-01", "2020-09-02", "2020-09-03", "2020-09-04", "2020-09-05", "2020-09-06", "2020-09-07", "2020-09-08", "2020-09-09", "2020-09-10", "2020-09-11", "2020-09-12", "2020-09-13", "2020-09-14", "2020-09-15", "2020-09-16", "2020-09-17", "2020-09-18", "2020-09-19", "2020-09-20", "2020-09-21", "2020-09-22", "2020-09-23", "2020-09-24", "2020-09-25", "2020-09-26", "2020-09-27", "2020-09-28", "2020-09-29", "2020-09-30", "2020-10-01", "2020-10-02", "2020-10-03", "2020-10-04", "2020-10-05", "2020-10-06", "2020-10-07", "2020-10-08", "2020-10-09", "2020-10-10", "2020-10-11", "2020-10-12", "2020-10-13", "2020-10-14", "2020-10-15", "2020-10-16", "2020-10-17", "2020-10-18", "2020-10-19", "2020-10-20", "2020-10-21", "2020-10-22", "2020-10-23", "2020-10-24", "2020-10-25", "2020-10-26", "2020-10-27", "2020-10-28", "2020-10-29", "2020-10-30", "2020-10-31", "2020-11-01", "2020-11-02", "2020-11-03", "2020-11-04", "2020-11-05", "2020-11-06", "2020-11-07", "2020-11-08", "2020-11-09", "2020-11-10", "2020-11-11", "2020-11-12", "2020-11-13", "2020-11-14", "2020-11-15", "2020-11-16", "2020-11-17", "2020-11-18", "2020-11-19", "2020-11-20", "2020-11-21", "2020-11-22", "2020-11-23", "2020-11-24", "2020-11-25", "2020-11-26", "2020-11-27", "2020-11-28", "2020-11-29", "2020-11-30", "2020-12-01", "2020-12-02", "2020-12-03", "2020-12-04", "2020-12-05", "2020-12-06", "2020-12-07", "2020-12-08", "2020-12-09", "2020-12-10", "2020-12-11", "2020-12-12", "2020-12-13", "2020-12-14", "2020-12-15", "2020-12-16", "2020-12-17", "2020-12-18", "2020-12-19", "2020-12-20", "2020-12-21", "2020-12-22", "2020-12-23", "2020-12-24", "2020-12-25", "2020-12-26", "2020-12-27", "2020-12-28", "2020-12-29", "2020-12-30", "2020-12-31", "2021-01-01", "2021-01-02", "2021-01-03", "2021-01-04", "2021-01-05", "2021-01-06", "2021-01-07", "2021-01-08", "2021-01-09", "2021-01-10", "2021-01-11", "2021-01-12", "2021-01-13", "2021-01-14", "2021-01-15", "2021-01-16", "2021-01-17", "2021-01-18", "2021-01-19", "2021-01-20", "2021-01-21", "2021-01-22", "2021-01-23", "2021-01-24", "2021-01-25", "2021-01-26", "2021-01-27", "2021-01-28", "2021-01-29", "2021-01-30", "2021-01-31", "2021-02-01", "2021-02-02", "2021-02-03", "2021-02-04", "2021-02-05", "2021-02-06", "2021-02-07", "2021-02-08", "2021-02-09", "2021-02-10", "2021-02-11", "2021-02-12", "2021-02-13", "2021-02-14", "2021-02-15", "2021-02-16", "2021-02-17", "2021-02-18", "2021-02-19", "2021-02-20", "2021-02-21", "2021-02-22", "2021-02-23", "2021-02-24", "2021-02-25", "2021-02-26", "2021-02-27", "2021-02-28", "2021-03-01", "2021-03-02", "2021-03-03", "2021-03-04", "2021-03-05", "2021-03-06", "2021-03-07", "2021-03-08", "2021-03-09", "2021-03-10", "2021-03-11", "2021-03-12", "2021-03-13", "2021-03-14", "2021-03-15", "2021-03-16", "2021-03-17", "2021-03-18", "2021-03-19", "2021-03-20", "2021-03-21", "2021-03-22", "2021-03-23", "2021-03-24", "2021-03-25", "2021-03-26", "2021-03-27", "2021-03-28", "2021-03-29", "2021-03-30", "2021-03-31", "2021-04-01", "2021-04-02", "2021-04-03", "2021-04-04", "2021-04-05", "2021-04-06", "2021-04-07", "2021-04-08", "2021-04-09", "2021-04-10", "2021-04-11", "2021-04-12", "2021-04-13", "2021-04-14", "2021-04-15", "2021-04-16", "2021-04-17", "2021-04-18", "2021-04-19", "2021-04-20", "2021-04-21", "2021-04-22", "2021-04-23", "2021-04-24", "2021-04-25", "2021-04-26", "2021-04-27", "2021-04-28", "2021-04-29", "2021-04-30", "2021-05-01", "2021-05-02", "2021-05-03", "2021-05-04", "2021-05-05", "2021-05-06", "2021-05-07", "2021-05-08", "2021-05-09", "2021-05-10", "2021-05-11", "2021-05-12", "2021-05-13", "2021-05-14", "2021-05-15", "2021-05-16", "2021-05-17", "2021-05-18", "2021-05-19", "2021-05-20", "2021-05-21", "2021-05-22", "2021-05-23", "2021-05-24", "2021-05-25", "2021-05-26", "2021-05-27", "2021-05-28", "2021-05-29", "2021-05-30", "2021-05-31", "2021-06-01", "2021-06-02", "2021-06-03", "2021-06-04", "2021-06-05", "2021-06-06", "2021-06-07", "2021-06-08", "2021-06-09", "2021-06-10", "2021-06-11", "2021-06-12", "2021-06-13", "2021-06-14", "2021-06-15", "2021-06-16", "2021-06-17", "2021-06-18", "2021-06-19", "2021-06-20", "2021-06-21", "2021-06-22", "2021-06-23", "2021-06-24", "2021-06-25", "2021-06-26", "2021-06-27", "2021-06-28", "2021-06-29", "2021-06-30", "2021-07-01", "2021-07-02", "2021-07-03", "2021-07-04", "2021-07-05", "2021-07-06", "2021-07-07", "2021-07-08", "2021-07-09", "2021-07-10", "2021-07-11", "2021-07-12", "2021-07-13", "2021-07-14", "2021-07-15", "2021-07-16", "2021-07-17", "2021-07-18", "2021-07-19", "2021-07-20", "2021-07-21", "2021-07-22", "2021-07-23", "2021-07-24", "2021-07-25", "2021-07-26", "2021-07-27", "2021-07-28", "2021-07-29", "2021-07-30", "2021-07-31", "2021-08-01", "2021-08-02", "2021-08-03", "2021-08-04", "2021-08-05", "2021-08-06", "2021-08-07", "2021-08-08", "2021-08-09", "2021-08-10", "2021-08-11", "2021-08-12", "2021-08-13", "2021-08-14", "2021-08-15", "2021-08-16", "2021-08-17", "2021-08-18", "2021-08-19", "2021-08-20", "2021-08-21", "2021-08-22", "2021-08-23", "2021-08-24", "2021-08-25", "2021-08-26", "2021-08-27", "2021-08-28", "2021-08-29", "2021-08-30", "2021-08-31", "2021-09-01", "2021-09-02", "2021-09-03", "2021-09-04", "2021-09-05", "2021-09-06", "2021-09-07", "2021-09-08", "2021-09-09", "2021-09-10", "2021-09-11", "2021-09-12", "2021-09-13", "2021-09-14", "2021-09-15", "2021-09-16", "2021-09-17", "2021-09-18", "2021-09-19", "2021-09-20", "2021-09-21", "2021-09-22", "2021-09-23", "2021-09-24", "2021-09-25", "2021-09-26", "2021-09-27", "2021-09-28", "2021-09-29", "2021-09-30", "2021-10-01", "2021-10-02", "2021-10-03", "2021-10-04", "2021-10-05", "2021-10-06", "2021-10-07", "2021-10-08", "2021-10-09", "2021-10-10", "2021-10-11", "2021-10-12", "2021-10-13", "2021-10-14", "2021-10-15", "2021-10-16", "2021-10-17", "2021-10-18", "2021-10-19", "2021-10-20", "2021-10-21", "2021-10-22", "2021-10-23", "2021-10-24", "2021-10-25", "2021-10-26", "2021-10-27", "2021-10-28", "2021-10-29", "2021-10-30", "2021-10-31", "2021-11-01", "2021-11-02", "2021-11-03", "2021-11-04", "2021-11-05", "2021-11-06", "2021-11-07", "2021-11-08", "2021-11-09", "2021-11-10", "2021-11-11", "2021-11-12", "2021-11-13", "2021-11-14", "2021-11-15", "2021-11-16", "2021-11-17", "2021-11-18", "2021-11-19", "2021-11-20", "2021-11-21", "2021-11-22", "2021-11-23", "2021-11-24", "2021-11-25", "2021-11-26", "2021-11-27", "2021-11-28", "2021-11-29", "2021-11-30", "2021-12-01", "2021-12-02", "2021-12-03", "2021-12-04", "2021-12-05", "2021-12-06", "2021-12-07", "2021-12-08", "2021-12-09", "2021-12-10", "2021-12-11", "2021-12-12", "2021-12-13", "2021-12-14", "2021-12-15", "2021-12-16", "2021-12-17", "2021-12-18", "2021-12-19", "2021-12-20" ], "xaxis": "x", "y": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 3.0, 4.0, 5.0, 6.0, 8.0, 10.0, 12.0, 14.0, 17.0, 20.0, 23.0, 26.0, 30.0, 34.0, 38.0, 42.0, 46.0, 50.0, 53.0, 58.0, 63.0, 67.0, 71.0, 74.0, 78.0, 82.0, 87.0, 92.0, 96.0, 100.0, 104.0, 107.0, 110.0, 114.0, 119.0, 123.0, 127.0, 130.0, 133.0, 136.0, 140.0, 145.0, 149.0, 152.0, 155.0, 157.0, 160.0, 163.0, 167.0, 170.0, 174.0, 177.0, 178.0, 181.0, 184.0, 188.0, 191.0, 194.0, 196.0, 198.0, 199.0, 201.0, 205.0, 208.0, 210.0, 213.0, 214.0, 216.0, 219.0, 222.0, 226.0, 228.0, 230.0, 231.0, 233.0, 236.0, 238.0, 241.0, 243.0, 245.0, 247.0, 248.0, 251.0, 253.0, 256.0, 258.0, 260.0, 262.0, 264.0, 267.0, 270.0, 272.0, 275.0, 277.0, 278.0, 280.0, 282.0, 285.0, 287.0, 290.0, 291.0, 292.0, 294.0, 298.0, 300.0, 304.0, 306.0, 309.0, 310.0, 312.0, 315.0, 318.0, 321.0, 324.0, 327.0, 328.0, 330.0, 333.0, 337.0, 340.0, 343.0, 347.0, 348.0, 351.0, 355.0, 358.0, 362.0, 365.0, 368.0, 370.0, 371.0, 375.0, 379.0, 383.0, 387.0, 390.0, 391.0, 394.0, 397.0, 401.0, 404.0, 408.0, 411.0, 412.0, 414.0, 417.0, 421.0, 424.0, 427.0, 430.0, 431.0, 432.0, 436.0, 439.0, 442.0, 445.0, 448.0, 449.0, 451.0, 454.0, 457.0, 460.0, 462.0, 465.0, 466.0, 467.0, 469.0, 472.0, 475.0, 478.0, 480.0, 481.0, 482.0, 486.0, 488.0, 490.0, 493.0, 495.0, 496.0, 497.0, 500.0, 503.0, 506.0, 508.0, 510.0, 511.0, 512.0, 515.0, 517.0, 520.0, 522.0, 524.0, 525.0, 531.0, 533.0, 535.0, 538.0, 540.0, 542.0, 543.0, 544.0, 546.0, 549.0, 551.0, 554.0, 556.0, 557.0, 558.0, 561.0, 564.0, 565.0, 569.0, 571.0, 572.0, 574.0, 577.0, 580.0, 582.0, 585.0, 588.0, 589.0, 590.0, 594.0, 597.0, 600.0, 603.0, 606.0, 608.0, 610.0, 613.0, 617.0, 620.0, 623.0, 627.0, 629.0, 631.0, 634.0, 639.0, 644.0, 648.0, 652.0, 655.0, 657.0, 662.0, 668.0, 672.0, 676.0, 679.0, 681.0, 684.0, 690.0, 697.0, 703.0, 709.0, 714.0, 717.0, 721.0, 727.0, 734.0, 740.0, 747.0, 753.0, 757.0, 760.0, 767.0, 775.0, 783.0, 789.0, 795.0, 799.0, 803.0, 811.0, 818.0, 825.0, 829.0, 833.0, 836.0, 840.0, 849.0, 857.0, 865.0, 870.0, 875.0, 879.0, 883.0, 892.0, 901.0, 910.0, 919.0, 927.0, 932.0, 936.0, 946.0, 956.0, 964.0, 973.0, 982.0, 986.0, 990.0, 997.0, 1008.0, 1019.0, 1028.0, 1037.0, 1041.0, 1046.0, 1056.0, 1066.0, 1076.0, 1084.0, 1092.0, 1097.0, 1101.0, 1108.0, 1118.0, 1125.0, 1137.0, 1144.0, 1148.0, 1152.0, 1160.0, 1168.0, 1177.0, 1184.0, 1190.0, 1193.0, 1196.0, 1201.0, 1207.0, 1214.0, 1220.0, 1225.0, 1227.0, 1230.0, 1237.0, 1244.0, 1250.0, 1255.0, 1259.0, 1262.0, 1265.0, 1270.0, 1276.0, 1281.0, 1285.0, 1290.0, 1291.0, 1293.0, 1298.0, 1302.0, 1306.0, 1310.0, 1312.0, 1314.0, 1316.0, 1318.0, 1322.0, 1326.0, 1329.0, 1331.0, 1333.0, 1335.0, 1338.0, 1341.0, 1345.0, 1348.0, 1351.0, 1352.0, 1353.0, 1356.0, 1359.0, 1362.0, 1364.0, 1366.0, 1367.0, 1368.0, 1371.0, 1376.0, 1379.0, 1383.0, 1388.0, 1388.0, 1390.0, 1393.0, 1396.0, 1398.0, 1400.0, 1403.0, 1404.0, 1405.0, 1408.0, 1410.0, 1413.0, 1415.0, 1417.0, 1418.0, 1420.0, 1422.0, 1424.0, 1427.0, 1429.0, 1431.0, 1432.0, 1433.0, 1436.0, 1438.0, 1440.0, 1442.0, 1444.0, 1445.0, 1446.0, 1448.0, 1450.0, 1452.0, 1454.0, 1456.0, 1457.0, 1458.0, 1460.0, 1461.0, 1463.0, 1465.0, 1466.0, 1467.0, 1468.0, 1470.0, 1472.0, 1476.0, 1478.0, 1479.0, 1479.0, 1480.0, 1489.0, 1491.0, 1492.0, 1494.0, 1495.0, 1496.0, 1497.0, 1498.0, 1499.0, 1501.0, 1502.0, 1503.0, 1504.0, 1505.0, 1506.0, 1507.0, 1508.0, 1510.0, 1510.0, 1511.0, 1512.0, 1513.0, 1515.0, 1516.0, 1517.0, 1518.0, 1519.0, 1519.0, 1520.0, 1522.0, 1523.0, 1524.0, 1525.0, 1525.0, 1526.0, 1527.0, 1528.0, 1529.0, 1531.0, 1531.0, 1532.0, 1533.0, 1534.0, 1535.0, 1537.0, 1538.0, 1539.0, 1539.0, 1540.0, 1542.0, 1543.0, 1545.0, 1546.0, 1548.0, 1548.0, 1549.0, 1551.0, 1553.0, 1555.0, 1557.0, 1559.0, 1560.0, 1561.0, 1563.0, 1566.0, 1568.0, 1571.0, 1573.0, 1574.0, 1576.0, 1579.0, 1582.0, 1585.0, 1588.0, 1590.0, 1591.0, 1594.0, 1598.0, 1602.0, 1606.0, 1611.0, 1613.0, 1614.0, 1618.0, 1622.0, 1627.0, 1632.0, 1637.0, 1640.0, 1641.0, 1645.0, 1649.0, 1655.0, 1662.0, 1667.0, 1670.0, 1671.0, 1673.0, 1680.0, 1685.0, 1693.0, 1697.0, 1701.0, 1702.0, 1707.0, 1712.0, 1719.0, 1726.0, 1731.0, 1733.0, 1735.0, 1740.0, 1746.0, 1753.0, 1760.0, 1766.0, 1767.0, 1770.0, 1775.0, 1781.0, 1787.0, 1793.0, 1798.0, 1800.0, 1801.0, 1806.0, 1810.0, 1816.0, 1823.0, 1827.0, 1828.0, 1830.0, 1832.0, 1838.0, 1844.0, 1849.0, 1853.0, 1855.0, 1856.0, 1860.0, 1864.0, 1871.0, 1875.0, 1879.0, 1881.0, 1881.0, 1884.0, 1887.0, 1892.0, 1896.0, 1900.0, 1902.0, 1902.0, 1905.0, 1907.0, 1911.0, 1914.0, 1918.0, 1920.0, 1920.0, 1923.0, 1926.0, 1929.0, 1932.0, 1936.0, 1938.0, 1939.0, 1941.0, 1944.0, 1947.0, 1950.0, 1953.0, 1955.0, 1955.0, 1958.0, 1960.0, 1964.0, 1966.0, 1967.0, 1967.0, 1968.0, 1972.0, 1974.0, 1979.0, 1985.0, 1989.0, 1990.0, 1991.0, 1994.0, 1996.0, 2000.0, 2004.0, 2007.0, 2008.0, 2009.0, 2011.0, 2014.0, 2018.0, 2021.0, 2024.0, 2025.0, 2026.0, 2029.0 ], "yaxis": "y", "type": "scattergl" }, { "hovertemplate": "Continent=Europe
    Date=%{x}
    Total Deaths per Million=%{y}", "legendgroup": "Europe", "line": { "color": "#00cc96", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "Europe", "showlegend": true, "x": [ "2020-02-23", "2020-02-24", "2020-02-25", "2020-02-26", "2020-02-27", "2020-02-28", "2020-02-29", "2020-03-01", "2020-03-02", "2020-03-03", "2020-03-04", "2020-03-05", "2020-03-06", "2020-03-07", "2020-03-08", "2020-03-09", "2020-03-10", "2020-03-11", "2020-03-12", "2020-03-13", "2020-03-14", "2020-03-15", "2020-03-16", "2020-03-17", "2020-03-18", "2020-03-19", "2020-03-20", "2020-03-21", "2020-03-22", "2020-03-23", "2020-03-24", "2020-03-25", "2020-03-26", "2020-03-27", "2020-03-28", "2020-03-29", "2020-03-30", "2020-03-31", "2020-04-01", "2020-04-02", "2020-04-03", "2020-04-04", "2020-04-05", "2020-04-06", "2020-04-07", "2020-04-08", "2020-04-09", "2020-04-10", "2020-04-11", "2020-04-12", "2020-04-13", "2020-04-14", "2020-04-15", "2020-04-16", "2020-04-17", "2020-04-18", "2020-04-19", "2020-04-20", "2020-04-21", "2020-04-22", "2020-04-23", "2020-04-24", "2020-04-25", "2020-04-26", "2020-04-27", "2020-04-28", "2020-04-29", "2020-04-30", "2020-05-01", "2020-05-02", "2020-05-03", "2020-05-04", "2020-05-05", "2020-05-06", "2020-05-07", "2020-05-08", "2020-05-09", "2020-05-10", "2020-05-11", "2020-05-12", "2020-05-13", "2020-05-14", "2020-05-15", "2020-05-16", "2020-05-17", "2020-05-18", "2020-05-19", "2020-05-20", "2020-05-21", "2020-05-22", "2020-05-23", "2020-05-24", "2020-05-25", "2020-05-26", "2020-05-27", "2020-05-28", "2020-05-29", "2020-05-30", "2020-05-31", "2020-06-01", "2020-06-02", "2020-06-03", "2020-06-04", "2020-06-05", "2020-06-06", "2020-06-07", "2020-06-08", "2020-06-09", "2020-06-10", "2020-06-11", "2020-06-12", "2020-06-13", "2020-06-14", "2020-06-15", "2020-06-16", "2020-06-17", "2020-06-18", "2020-06-19", "2020-06-20", "2020-06-21", "2020-06-22", "2020-06-23", "2020-06-24", "2020-06-25", "2020-06-26", "2020-06-27", "2020-06-28", "2020-06-29", "2020-06-30", "2020-07-01", "2020-07-02", "2020-07-03", "2020-07-04", "2020-07-05", "2020-07-06", "2020-07-07", "2020-07-08", "2020-07-09", "2020-07-10", "2020-07-11", "2020-07-12", "2020-07-13", "2020-07-14", "2020-07-15", "2020-07-16", "2020-07-17", "2020-07-18", "2020-07-19", "2020-07-20", "2020-07-21", "2020-07-22", "2020-07-23", "2020-07-24", "2020-07-25", "2020-07-26", "2020-07-27", "2020-07-28", "2020-07-29", "2020-07-30", "2020-07-31", "2020-08-01", "2020-08-02", "2020-08-03", "2020-08-04", "2020-08-05", "2020-08-06", "2020-08-07", "2020-08-08", "2020-08-09", "2020-08-10", "2020-08-11", "2020-08-12", "2020-08-13", "2020-08-14", "2020-08-15", "2020-08-16", "2020-08-17", "2020-08-18", "2020-08-19", "2020-08-20", "2020-08-21", "2020-08-22", "2020-08-23", "2020-08-24", "2020-08-25", "2020-08-26", "2020-08-27", "2020-08-28", "2020-08-29", "2020-08-30", "2020-08-31", "2020-09-01", "2020-09-02", "2020-09-03", "2020-09-04", "2020-09-05", "2020-09-06", "2020-09-07", "2020-09-08", "2020-09-09", "2020-09-10", "2020-09-11", "2020-09-12", "2020-09-13", "2020-09-14", "2020-09-15", "2020-09-16", "2020-09-17", "2020-09-18", "2020-09-19", "2020-09-20", "2020-09-21", "2020-09-22", "2020-09-23", "2020-09-24", "2020-09-25", "2020-09-26", "2020-09-27", "2020-09-28", "2020-09-29", "2020-09-30", "2020-10-01", "2020-10-02", "2020-10-03", "2020-10-04", "2020-10-05", "2020-10-06", "2020-10-07", "2020-10-08", "2020-10-09", "2020-10-10", "2020-10-11", "2020-10-12", "2020-10-13", "2020-10-14", "2020-10-15", "2020-10-16", "2020-10-17", "2020-10-18", "2020-10-19", "2020-10-20", "2020-10-21", "2020-10-22", "2020-10-23", "2020-10-24", "2020-10-25", "2020-10-26", "2020-10-27", "2020-10-28", "2020-10-29", "2020-10-30", "2020-10-31", "2020-11-01", "2020-11-02", "2020-11-03", "2020-11-04", "2020-11-05", "2020-11-06", "2020-11-07", "2020-11-08", "2020-11-09", "2020-11-10", "2020-11-11", "2020-11-12", "2020-11-13", "2020-11-14", "2020-11-15", "2020-11-16", "2020-11-17", "2020-11-18", "2020-11-19", "2020-11-20", "2020-11-21", "2020-11-22", "2020-11-23", "2020-11-24", "2020-11-25", "2020-11-26", "2020-11-27", "2020-11-28", "2020-11-29", "2020-11-30", "2020-12-01", "2020-12-02", "2020-12-03", "2020-12-04", "2020-12-05", "2020-12-06", "2020-12-07", "2020-12-08", "2020-12-09", "2020-12-10", "2020-12-11", "2020-12-12", "2020-12-13", "2020-12-14", "2020-12-15", "2020-12-16", "2020-12-17", "2020-12-18", "2020-12-19", "2020-12-20", "2020-12-21", "2020-12-22", "2020-12-23", "2020-12-24", "2020-12-25", "2020-12-26", "2020-12-27", "2020-12-28", "2020-12-29", "2020-12-30", "2020-12-31", "2021-01-01", "2021-01-02", "2021-01-03", "2021-01-04", "2021-01-05", "2021-01-06", "2021-01-07", "2021-01-08", "2021-01-09", "2021-01-10", "2021-01-11", "2021-01-12", "2021-01-13", "2021-01-14", "2021-01-15", "2021-01-16", "2021-01-17", "2021-01-18", "2021-01-19", "2021-01-20", "2021-01-21", "2021-01-22", "2021-01-23", "2021-01-24", "2021-01-25", "2021-01-26", "2021-01-27", "2021-01-28", "2021-01-29", "2021-01-30", "2021-01-31", "2021-02-01", "2021-02-02", "2021-02-03", "2021-02-04", "2021-02-05", "2021-02-06", "2021-02-07", "2021-02-08", "2021-02-09", "2021-02-10", "2021-02-11", "2021-02-12", "2021-02-13", "2021-02-14", "2021-02-15", "2021-02-16", "2021-02-17", "2021-02-18", "2021-02-19", "2021-02-20", "2021-02-21", "2021-02-22", "2021-02-23", "2021-02-24", "2021-02-25", "2021-02-26", "2021-02-27", "2021-02-28", "2021-03-01", "2021-03-02", "2021-03-03", "2021-03-04", "2021-03-05", "2021-03-06", "2021-03-07", "2021-03-08", "2021-03-09", "2021-03-10", "2021-03-11", "2021-03-12", "2021-03-13", "2021-03-14", "2021-03-15", "2021-03-16", "2021-03-17", "2021-03-18", "2021-03-19", "2021-03-20", "2021-03-21", "2021-03-22", "2021-03-23", "2021-03-24", "2021-03-25", "2021-03-26", "2021-03-27", "2021-03-28", "2021-03-29", "2021-03-30", "2021-03-31", "2021-04-01", "2021-04-02", "2021-04-03", "2021-04-04", "2021-04-05", "2021-04-06", "2021-04-07", "2021-04-08", "2021-04-09", "2021-04-10", "2021-04-11", "2021-04-12", "2021-04-13", "2021-04-14", "2021-04-15", "2021-04-16", "2021-04-17", "2021-04-18", "2021-04-19", "2021-04-20", "2021-04-21", "2021-04-22", "2021-04-23", "2021-04-24", "2021-04-25", "2021-04-26", "2021-04-27", "2021-04-28", "2021-04-29", "2021-04-30", "2021-05-01", "2021-05-02", "2021-05-03", "2021-05-04", "2021-05-05", "2021-05-06", "2021-05-07", "2021-05-08", "2021-05-09", "2021-05-10", "2021-05-11", "2021-05-12", "2021-05-13", "2021-05-14", "2021-05-15", "2021-05-16", "2021-05-17", "2021-05-18", "2021-05-19", "2021-05-20", "2021-05-21", "2021-05-22", "2021-05-23", "2021-05-24", "2021-05-25", "2021-05-26", "2021-05-27", "2021-05-28", "2021-05-29", "2021-05-30", "2021-05-31", "2021-06-01", "2021-06-02", "2021-06-03", "2021-06-04", "2021-06-05", "2021-06-06", "2021-06-07", "2021-06-08", "2021-06-09", "2021-06-10", "2021-06-11", "2021-06-12", "2021-06-13", "2021-06-14", "2021-06-15", "2021-06-16", "2021-06-17", "2021-06-18", "2021-06-19", "2021-06-20", "2021-06-21", "2021-06-22", "2021-06-23", "2021-06-24", "2021-06-25", "2021-06-26", "2021-06-27", "2021-06-28", "2021-06-29", "2021-06-30", "2021-07-01", "2021-07-02", "2021-07-03", "2021-07-04", "2021-07-05", "2021-07-06", "2021-07-07", "2021-07-08", "2021-07-09", "2021-07-10", "2021-07-11", "2021-07-12", "2021-07-13", "2021-07-14", "2021-07-15", "2021-07-16", "2021-07-17", "2021-07-18", "2021-07-19", "2021-07-20", "2021-07-21", "2021-07-22", "2021-07-23", "2021-07-24", "2021-07-25", "2021-07-26", "2021-07-27", "2021-07-28", "2021-07-29", "2021-07-30", "2021-07-31", "2021-08-01", "2021-08-02", "2021-08-03", "2021-08-04", "2021-08-05", "2021-08-06", "2021-08-07", "2021-08-08", "2021-08-09", "2021-08-10", "2021-08-11", "2021-08-12", "2021-08-13", "2021-08-14", "2021-08-15", "2021-08-16", "2021-08-17", "2021-08-18", "2021-08-19", "2021-08-20", "2021-08-21", "2021-08-22", "2021-08-23", "2021-08-24", "2021-08-25", "2021-08-26", "2021-08-27", "2021-08-28", "2021-08-29", "2021-08-30", "2021-08-31", "2021-09-01", "2021-09-02", "2021-09-03", "2021-09-04", "2021-09-05", "2021-09-06", "2021-09-07", "2021-09-08", "2021-09-09", "2021-09-10", "2021-09-11", "2021-09-12", "2021-09-13", "2021-09-14", "2021-09-15", "2021-09-16", "2021-09-17", "2021-09-18", "2021-09-19", "2021-09-20", "2021-09-21", "2021-09-22", "2021-09-23", "2021-09-24", "2021-09-25", "2021-09-26", "2021-09-27", "2021-09-28", "2021-09-29", "2021-09-30", "2021-10-01", "2021-10-02", "2021-10-03", "2021-10-04", "2021-10-05", "2021-10-06", "2021-10-07", "2021-10-08", "2021-10-09", "2021-10-10", "2021-10-11", "2021-10-12", "2021-10-13", "2021-10-14", "2021-10-15", "2021-10-16", "2021-10-17", "2021-10-18", "2021-10-19", "2021-10-20", "2021-10-21", "2021-10-22", "2021-10-23", "2021-10-24", "2021-10-25", "2021-10-26", "2021-10-27", "2021-10-28", "2021-10-29", "2021-10-30", "2021-10-31", "2021-11-01", "2021-11-02", "2021-11-03", "2021-11-04", "2021-11-05", "2021-11-06", "2021-11-07", "2021-11-08", "2021-11-09", "2021-11-10", "2021-11-11", "2021-11-12", "2021-11-13", "2021-11-14", "2021-11-15", "2021-11-16", "2021-11-17", "2021-11-18", "2021-11-19", "2021-11-20", "2021-11-21", "2021-11-22", "2021-11-23", "2021-11-24", "2021-11-25", "2021-11-26", "2021-11-27", "2021-11-28", "2021-11-29", "2021-11-30", "2021-12-01", "2021-12-02", "2021-12-03", "2021-12-04", "2021-12-05", "2021-12-06", "2021-12-07", "2021-12-08", "2021-12-09", "2021-12-10", "2021-12-11", "2021-12-12", "2021-12-13", "2021-12-14", "2021-12-15", "2021-12-16", "2021-12-17", "2021-12-18", "2021-12-19", "2021-12-20" ], "xaxis": "x", "y": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 5.0, 6.0, 7.0, 9.0, 10.0, 12.0, 14.0, 17.0, 19.0, 23.0, 26.0, 29.0, 32.0, 36.0, 41.0, 46.0, 50.0, 55.0, 58.0, 63.0, 69.0, 73.0, 79.0, 84.0, 88.0, 92.0, 95.0, 100.0, 106.0, 111.0, 115.0, 119.0, 122.0, 126.0, 130.0, 134.0, 138.0, 142.0, 145.0, 147.0, 150.0, 153.0, 156.0, 159.0, 161.0, 164.0, 165.0, 167.0, 169.0, 172.0, 175.0, 177.0, 178.0, 179.0, 181.0, 183.0, 185.0, 187.0, 188.0, 190.0, 191.0, 192.0, 193.0, 194.0, 195.0, 197.0, 198.0, 199.0, 198.0, 199.0, 200.0, 201.0, 202.0, 203.0, 204.0, 204.0, 205.0, 206.0, 207.0, 208.0, 209.0, 209.0, 210.0, 210.0, 211.0, 212.0, 212.0, 213.0, 213.0, 214.0, 215.0, 215.0, 216.0, 218.0, 218.0, 219.0, 219.0, 220.0, 220.0, 221.0, 221.0, 222.0, 222.0, 222.0, 223.0, 224.0, 224.0, 225.0, 225.0, 225.0, 226.0, 226.0, 227.0, 227.0, 228.0, 228.0, 229.0, 229.0, 230.0, 230.0, 231.0, 231.0, 231.0, 232.0, 232.0, 233.0, 233.0, 233.0, 234.0, 234.0, 234.0, 235.0, 235.0, 236.0, 236.0, 237.0, 237.0, 238.0, 238.0, 238.0, 239.0, 239.0, 240.0, 240.0, 240.0, 241.0, 241.0, 242.0, 242.0, 243.0, 243.0, 244.0, 244.0, 244.0, 245.0, 245.0, 246.0, 246.0, 246.0, 247.0, 247.0, 248.0, 248.0, 248.0, 249.0, 249.0, 250.0, 250.0, 251.0, 251.0, 252.0, 252.0, 253.0, 253.0, 254.0, 254.0, 255.0, 255.0, 256.0, 256.0, 257.0, 257.0, 258.0, 259.0, 260.0, 261.0, 261.0, 262.0, 263.0, 263.0, 264.0, 265.0, 266.0, 266.0, 267.0, 268.0, 269.0, 270.0, 271.0, 272.0, 272.0, 273.0, 275.0, 276.0, 277.0, 278.0, 279.0, 280.0, 281.0, 282.0, 284.0, 286.0, 287.0, 289.0, 290.0, 291.0, 294.0, 296.0, 298.0, 300.0, 302.0, 304.0, 306.0, 310.0, 313.0, 316.0, 319.0, 322.0, 325.0, 328.0, 333.0, 339.0, 343.0, 349.0, 352.0, 355.0, 360.0, 366.0, 372.0, 377.0, 383.0, 387.0, 391.0, 396.0, 402.0, 409.0, 415.0, 421.0, 426.0, 430.0, 435.0, 443.0, 450.0, 456.0, 463.0, 468.0, 472.0, 478.0, 485.0, 492.0, 498.0, 505.0, 510.0, 514.0, 519.0, 526.0, 532.0, 539.0, 546.0, 551.0, 555.0, 560.0, 568.0, 575.0, 582.0, 589.0, 594.0, 598.0, 603.0, 610.0, 617.0, 623.0, 627.0, 631.0, 635.0, 640.0, 648.0, 656.0, 662.0, 666.0, 670.0, 674.0, 679.0, 687.0, 693.0, 700.0, 707.0, 713.0, 717.0, 722.0, 730.0, 738.0, 745.0, 752.0, 758.0, 762.0, 766.0, 775.0, 784.0, 791.0, 798.0, 804.0, 807.0, 813.0, 820.0, 828.0, 836.0, 842.0, 848.0, 851.0, 857.0, 865.0, 872.0, 878.0, 885.0, 889.0, 892.0, 896.0, 903.0, 910.0, 915.0, 921.0, 924.0, 927.0, 930.0, 936.0, 941.0, 946.0, 951.0, 954.0, 956.0, 960.0, 964.0, 969.0, 973.0, 977.0, 980.0, 982.0, 986.0, 990.0, 995.0, 999.0, 1003.0, 1006.0, 1008.0, 1012.0, 1016.0, 1020.0, 1024.0, 1028.0, 1031.0, 1033.0, 1037.0, 1041.0, 1045.0, 1049.0, 1053.0, 1057.0, 1062.0, 1066.0, 1070.0, 1075.0, 1080.0, 1085.0, 1089.0, 1091.0, 1095.0, 1100.0, 1105.0, 1109.0, 1114.0, 1118.0, 1121.0, 1124.0, 1128.0, 1134.0, 1139.0, 1145.0, 1149.0, 1152.0, 1156.0, 1161.0, 1167.0, 1171.0, 1176.0, 1180.0, 1183.0, 1187.0, 1192.0, 1197.0, 1202.0, 1206.0, 1210.0, 1213.0, 1217.0, 1221.0, 1226.0, 1230.0, 1234.0, 1237.0, 1239.0, 1242.0, 1246.0, 1249.0, 1253.0, 1257.0, 1260.0, 1262.0, 1265.0, 1268.0, 1271.0, 1274.0, 1277.0, 1279.0, 1281.0, 1283.0, 1286.0, 1288.0, 1291.0, 1293.0, 1295.0, 1296.0, 1298.0, 1300.0, 1303.0, 1305.0, 1306.0, 1308.0, 1309.0, 1311.0, 1312.0, 1314.0, 1316.0, 1317.0, 1319.0, 1320.0, 1321.0, 1323.0, 1324.0, 1326.0, 1327.0, 1328.0, 1329.0, 1330.0, 1332.0, 1333.0, 1334.0, 1335.0, 1336.0, 1337.0, 1338.0, 1340.0, 1341.0, 1342.0, 1344.0, 1345.0, 1346.0, 1347.0, 1349.0, 1350.0, 1351.0, 1353.0, 1354.0, 1355.0, 1356.0, 1357.0, 1358.0, 1360.0, 1361.0, 1362.0, 1363.0, 1364.0, 1366.0, 1367.0, 1368.0, 1369.0, 1370.0, 1372.0, 1373.0, 1374.0, 1376.0, 1377.0, 1378.0, 1380.0, 1381.0, 1382.0, 1384.0, 1385.0, 1387.0, 1388.0, 1389.0, 1391.0, 1392.0, 1394.0, 1395.0, 1398.0, 1399.0, 1401.0, 1402.0, 1404.0, 1406.0, 1408.0, 1410.0, 1411.0, 1413.0, 1414.0, 1417.0, 1419.0, 1421.0, 1423.0, 1425.0, 1427.0, 1428.0, 1432.0, 1434.0, 1436.0, 1438.0, 1440.0, 1442.0, 1444.0, 1447.0, 1449.0, 1452.0, 1455.0, 1457.0, 1459.0, 1461.0, 1464.0, 1466.0, 1469.0, 1471.0, 1473.0, 1475.0, 1477.0, 1480.0, 1483.0, 1485.0, 1488.0, 1490.0, 1492.0, 1494.0, 1497.0, 1500.0, 1502.0, 1505.0, 1507.0, 1509.0, 1511.0, 1514.0, 1517.0, 1520.0, 1522.0, 1525.0, 1527.0, 1529.0, 1532.0, 1535.0, 1539.0, 1542.0, 1545.0, 1547.0, 1549.0, 1552.0, 1556.0, 1559.0, 1563.0, 1566.0, 1569.0, 1571.0, 1574.0, 1578.0, 1582.0, 1586.0, 1590.0, 1593.0, 1596.0, 1600.0, 1604.0, 1609.0, 1613.0, 1618.0, 1621.0, 1625.0, 1628.0, 1633.0, 1638.0, 1643.0, 1648.0, 1652.0, 1656.0, 1660.0, 1665.0, 1671.0, 1676.0, 1681.0, 1685.0, 1689.0, 1693.0, 1699.0, 1705.0, 1710.0, 1715.0, 1719.0, 1723.0, 1728.0, 1733.0, 1739.0, 1744.0, 1749.0, 1753.0, 1757.0, 1762.0, 1767.0, 1773.0, 1778.0, 1783.0, 1787.0, 1790.0, 1795.0, 1801.0, 1806.0, 1811.0, 1817.0, 1821.0, 1824.0, 1828.0, 1834.0, 1839.0, 1844.0, 1849.0, 1853.0, 1856.0, 1860.0 ], "yaxis": "y", "type": "scattergl" }, { "hovertemplate": "Continent=Asia
    Date=%{x}
    Total Deaths per Million=%{y}", "legendgroup": "Asia", "line": { "color": "#ab63fa", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "Asia", "showlegend": true, "x": [ "2020-02-23", "2020-02-24", "2020-02-25", "2020-02-26", "2020-02-27", "2020-02-28", "2020-02-29", "2020-03-01", "2020-03-02", "2020-03-03", "2020-03-04", "2020-03-05", "2020-03-06", "2020-03-07", "2020-03-08", "2020-03-09", "2020-03-10", "2020-03-11", "2020-03-12", "2020-03-13", "2020-03-14", "2020-03-15", "2020-03-16", "2020-03-17", "2020-03-18", "2020-03-19", "2020-03-20", "2020-03-21", "2020-03-22", "2020-03-23", "2020-03-24", "2020-03-25", "2020-03-26", "2020-03-27", "2020-03-28", "2020-03-29", "2020-03-30", "2020-03-31", "2020-04-01", "2020-04-02", "2020-04-03", "2020-04-04", "2020-04-05", "2020-04-06", "2020-04-07", "2020-04-08", "2020-04-09", "2020-04-10", "2020-04-11", "2020-04-12", "2020-04-13", "2020-04-14", "2020-04-15", "2020-04-16", "2020-04-17", "2020-04-18", "2020-04-19", "2020-04-20", "2020-04-21", "2020-04-22", "2020-04-23", "2020-04-24", "2020-04-25", "2020-04-26", "2020-04-27", "2020-04-28", "2020-04-29", "2020-04-30", "2020-05-01", "2020-05-02", "2020-05-03", "2020-05-04", "2020-05-05", "2020-05-06", "2020-05-07", "2020-05-08", "2020-05-09", "2020-05-10", "2020-05-11", "2020-05-12", "2020-05-13", "2020-05-14", "2020-05-15", "2020-05-16", "2020-05-17", "2020-05-18", "2020-05-19", "2020-05-20", "2020-05-21", "2020-05-22", "2020-05-23", "2020-05-24", "2020-05-25", "2020-05-26", "2020-05-27", "2020-05-28", "2020-05-29", "2020-05-30", "2020-05-31", "2020-06-01", "2020-06-02", "2020-06-03", "2020-06-04", "2020-06-05", "2020-06-06", "2020-06-07", "2020-06-08", "2020-06-09", "2020-06-10", "2020-06-11", "2020-06-12", "2020-06-13", "2020-06-14", "2020-06-15", "2020-06-16", "2020-06-17", "2020-06-18", "2020-06-19", "2020-06-20", "2020-06-21", "2020-06-22", "2020-06-23", "2020-06-24", "2020-06-25", "2020-06-26", "2020-06-27", "2020-06-28", "2020-06-29", "2020-06-30", "2020-07-01", "2020-07-02", "2020-07-03", "2020-07-04", "2020-07-05", "2020-07-06", "2020-07-07", "2020-07-08", "2020-07-09", "2020-07-10", "2020-07-11", "2020-07-12", "2020-07-13", "2020-07-14", "2020-07-15", "2020-07-16", "2020-07-17", "2020-07-18", "2020-07-19", "2020-07-20", "2020-07-21", "2020-07-22", "2020-07-23", "2020-07-24", "2020-07-25", "2020-07-26", "2020-07-27", "2020-07-28", "2020-07-29", "2020-07-30", "2020-07-31", "2020-08-01", "2020-08-02", "2020-08-03", "2020-08-04", "2020-08-05", "2020-08-06", "2020-08-07", "2020-08-08", "2020-08-09", "2020-08-10", "2020-08-11", "2020-08-12", "2020-08-13", "2020-08-14", "2020-08-15", "2020-08-16", "2020-08-17", "2020-08-18", "2020-08-19", "2020-08-20", "2020-08-21", "2020-08-22", "2020-08-23", "2020-08-24", "2020-08-25", "2020-08-26", "2020-08-27", "2020-08-28", "2020-08-29", "2020-08-30", "2020-08-31", "2020-09-01", "2020-09-02", "2020-09-03", "2020-09-04", "2020-09-05", "2020-09-06", "2020-09-07", "2020-09-08", "2020-09-09", "2020-09-10", "2020-09-11", "2020-09-12", "2020-09-13", "2020-09-14", "2020-09-15", "2020-09-16", "2020-09-17", "2020-09-18", "2020-09-19", "2020-09-20", "2020-09-21", "2020-09-22", "2020-09-23", "2020-09-24", "2020-09-25", "2020-09-26", "2020-09-27", "2020-09-28", "2020-09-29", "2020-09-30", "2020-10-01", "2020-10-02", "2020-10-03", "2020-10-04", "2020-10-05", "2020-10-06", "2020-10-07", "2020-10-08", "2020-10-09", "2020-10-10", "2020-10-11", "2020-10-12", "2020-10-13", "2020-10-14", "2020-10-15", "2020-10-16", "2020-10-17", "2020-10-18", "2020-10-19", "2020-10-20", "2020-10-21", "2020-10-22", "2020-10-23", "2020-10-24", "2020-10-25", "2020-10-26", "2020-10-27", "2020-10-28", "2020-10-29", "2020-10-30", "2020-10-31", "2020-11-01", "2020-11-02", "2020-11-03", "2020-11-04", "2020-11-05", "2020-11-06", "2020-11-07", "2020-11-08", "2020-11-09", "2020-11-10", "2020-11-11", "2020-11-12", "2020-11-13", "2020-11-14", "2020-11-15", "2020-11-16", "2020-11-17", "2020-11-18", "2020-11-19", "2020-11-20", "2020-11-21", "2020-11-22", "2020-11-23", "2020-11-24", "2020-11-25", "2020-11-26", "2020-11-27", "2020-11-28", "2020-11-29", "2020-11-30", "2020-12-01", "2020-12-02", "2020-12-03", "2020-12-04", "2020-12-05", "2020-12-06", "2020-12-07", "2020-12-08", "2020-12-09", "2020-12-10", "2020-12-11", "2020-12-12", "2020-12-13", "2020-12-14", "2020-12-15", "2020-12-16", "2020-12-17", "2020-12-18", "2020-12-19", "2020-12-20", "2020-12-21", "2020-12-22", "2020-12-23", "2020-12-24", "2020-12-25", "2020-12-26", "2020-12-27", "2020-12-28", "2020-12-29", "2020-12-30", "2020-12-31", "2021-01-01", "2021-01-02", "2021-01-03", "2021-01-04", "2021-01-05", "2021-01-06", "2021-01-07", "2021-01-08", "2021-01-09", "2021-01-10", "2021-01-11", "2021-01-12", "2021-01-13", "2021-01-14", "2021-01-15", "2021-01-16", "2021-01-17", "2021-01-18", "2021-01-19", "2021-01-20", "2021-01-21", "2021-01-22", "2021-01-23", "2021-01-24", "2021-01-25", "2021-01-26", "2021-01-27", "2021-01-28", "2021-01-29", "2021-01-30", "2021-01-31", "2021-02-01", "2021-02-02", "2021-02-03", "2021-02-04", "2021-02-05", "2021-02-06", "2021-02-07", "2021-02-08", "2021-02-09", "2021-02-10", "2021-02-11", "2021-02-12", "2021-02-13", "2021-02-14", "2021-02-15", "2021-02-16", "2021-02-17", "2021-02-18", "2021-02-19", "2021-02-20", "2021-02-21", "2021-02-22", "2021-02-23", "2021-02-24", "2021-02-25", "2021-02-26", "2021-02-27", "2021-02-28", "2021-03-01", "2021-03-02", "2021-03-03", "2021-03-04", "2021-03-05", "2021-03-06", "2021-03-07", "2021-03-08", "2021-03-09", "2021-03-10", "2021-03-11", "2021-03-12", "2021-03-13", "2021-03-14", "2021-03-15", "2021-03-16", "2021-03-17", "2021-03-18", "2021-03-19", "2021-03-20", "2021-03-21", "2021-03-22", "2021-03-23", "2021-03-24", "2021-03-25", "2021-03-26", "2021-03-27", "2021-03-28", "2021-03-29", "2021-03-30", "2021-03-31", "2021-04-01", "2021-04-02", "2021-04-03", "2021-04-04", "2021-04-05", "2021-04-06", "2021-04-07", "2021-04-08", "2021-04-09", "2021-04-10", "2021-04-11", "2021-04-12", "2021-04-13", "2021-04-14", "2021-04-15", "2021-04-16", "2021-04-17", "2021-04-18", "2021-04-19", "2021-04-20", "2021-04-21", "2021-04-22", "2021-04-23", "2021-04-24", "2021-04-25", "2021-04-26", "2021-04-27", "2021-04-28", "2021-04-29", "2021-04-30", "2021-05-01", "2021-05-02", "2021-05-03", "2021-05-04", "2021-05-05", "2021-05-06", "2021-05-07", "2021-05-08", "2021-05-09", "2021-05-10", "2021-05-11", "2021-05-12", "2021-05-13", "2021-05-14", "2021-05-15", "2021-05-16", "2021-05-17", "2021-05-18", "2021-05-19", "2021-05-20", "2021-05-21", "2021-05-22", "2021-05-23", "2021-05-24", "2021-05-25", "2021-05-26", "2021-05-27", "2021-05-28", "2021-05-29", "2021-05-30", "2021-05-31", "2021-06-01", "2021-06-02", "2021-06-03", "2021-06-04", "2021-06-05", "2021-06-06", "2021-06-07", "2021-06-08", "2021-06-09", "2021-06-10", "2021-06-11", "2021-06-12", "2021-06-13", "2021-06-14", "2021-06-15", "2021-06-16", "2021-06-17", "2021-06-18", "2021-06-19", "2021-06-20", "2021-06-21", "2021-06-22", "2021-06-23", "2021-06-24", "2021-06-25", "2021-06-26", "2021-06-27", "2021-06-28", "2021-06-29", "2021-06-30", "2021-07-01", "2021-07-02", "2021-07-03", "2021-07-04", "2021-07-05", "2021-07-06", "2021-07-07", "2021-07-08", "2021-07-09", "2021-07-10", "2021-07-11", "2021-07-12", "2021-07-13", "2021-07-14", "2021-07-15", "2021-07-16", "2021-07-17", "2021-07-18", "2021-07-19", "2021-07-20", "2021-07-21", "2021-07-22", "2021-07-23", "2021-07-24", "2021-07-25", "2021-07-26", "2021-07-27", "2021-07-28", "2021-07-29", "2021-07-30", "2021-07-31", "2021-08-01", "2021-08-02", "2021-08-03", "2021-08-04", "2021-08-05", "2021-08-06", "2021-08-07", "2021-08-08", "2021-08-09", "2021-08-10", "2021-08-11", "2021-08-12", "2021-08-13", "2021-08-14", "2021-08-15", "2021-08-16", "2021-08-17", "2021-08-18", "2021-08-19", "2021-08-20", "2021-08-21", "2021-08-22", "2021-08-23", "2021-08-24", "2021-08-25", "2021-08-26", "2021-08-27", "2021-08-28", "2021-08-29", "2021-08-30", "2021-08-31", "2021-09-01", "2021-09-02", "2021-09-03", "2021-09-04", "2021-09-05", "2021-09-06", "2021-09-07", "2021-09-08", "2021-09-09", "2021-09-10", "2021-09-11", "2021-09-12", "2021-09-13", "2021-09-14", "2021-09-15", "2021-09-16", "2021-09-17", "2021-09-18", "2021-09-19", "2021-09-20", "2021-09-21", "2021-09-22", "2021-09-23", "2021-09-24", "2021-09-25", "2021-09-26", "2021-09-27", "2021-09-28", "2021-09-29", "2021-09-30", "2021-10-01", "2021-10-02", "2021-10-03", "2021-10-04", "2021-10-05", "2021-10-06", "2021-10-07", "2021-10-08", "2021-10-09", "2021-10-10", "2021-10-11", "2021-10-12", "2021-10-13", "2021-10-14", "2021-10-15", "2021-10-16", "2021-10-17", "2021-10-18", "2021-10-19", "2021-10-20", "2021-10-21", "2021-10-22", "2021-10-23", "2021-10-24", "2021-10-25", "2021-10-26", "2021-10-27", "2021-10-28", "2021-10-29", "2021-10-30", "2021-10-31", "2021-11-01", "2021-11-02", "2021-11-03", "2021-11-04", "2021-11-05", "2021-11-06", "2021-11-07", "2021-11-08", "2021-11-09", "2021-11-10", "2021-11-11", "2021-11-12", "2021-11-13", "2021-11-14", "2021-11-15", "2021-11-16", "2021-11-17", "2021-11-18", "2021-11-19", "2021-11-20", "2021-11-21", "2021-11-22", "2021-11-23", "2021-11-24", "2021-11-25", "2021-11-26", "2021-11-27", "2021-11-28", "2021-11-29", "2021-11-30", "2021-12-01", "2021-12-02", "2021-12-03", "2021-12-04", "2021-12-05", "2021-12-06", "2021-12-07", "2021-12-08", "2021-12-09", "2021-12-10", "2021-12-11", "2021-12-12", "2021-12-13", "2021-12-14", "2021-12-15", "2021-12-16", "2021-12-17", "2021-12-18", "2021-12-19", "2021-12-20" ], "xaxis": "x", "y": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 8.0, 8.0, 8.0, 8.0, 8.0, 8.0, 9.0, 9.0, 9.0, 9.0, 9.0, 9.0, 10.0, 10.0, 10.0, 11.0, 11.0, 11.0, 11.0, 12.0, 12.0, 12.0, 12.0, 12.0, 13.0, 13.0, 13.0, 13.0, 14.0, 14.0, 14.0, 14.0, 15.0, 15.0, 15.0, 15.0, 16.0, 16.0, 16.0, 16.0, 17.0, 17.0, 17.0, 18.0, 18.0, 18.0, 19.0, 19.0, 19.0, 20.0, 20.0, 20.0, 21.0, 21.0, 21.0, 22.0, 22.0, 22.0, 22.0, 23.0, 23.0, 23.0, 24.0, 24.0, 24.0, 25.0, 25.0, 25.0, 26.0, 26.0, 26.0, 27.0, 27.0, 27.0, 28.0, 28.0, 28.0, 29.0, 29.0, 29.0, 30.0, 30.0, 30.0, 31.0, 31.0, 31.0, 32.0, 32.0, 32.0, 33.0, 33.0, 33.0, 34.0, 34.0, 34.0, 35.0, 35.0, 36.0, 36.0, 36.0, 37.0, 37.0, 37.0, 38.0, 38.0, 39.0, 39.0, 39.0, 40.0, 40.0, 41.0, 41.0, 41.0, 42.0, 42.0, 43.0, 43.0, 43.0, 44.0, 44.0, 45.0, 45.0, 45.0, 46.0, 46.0, 47.0, 47.0, 47.0, 48.0, 48.0, 49.0, 49.0, 49.0, 50.0, 50.0, 50.0, 51.0, 51.0, 52.0, 52.0, 52.0, 53.0, 53.0, 53.0, 54.0, 54.0, 54.0, 55.0, 55.0, 55.0, 56.0, 56.0, 57.0, 57.0, 57.0, 58.0, 58.0, 59.0, 59.0, 59.0, 60.0, 60.0, 60.0, 61.0, 61.0, 62.0, 62.0, 63.0, 63.0, 63.0, 64.0, 64.0, 65.0, 65.0, 66.0, 66.0, 66.0, 67.0, 67.0, 68.0, 68.0, 69.0, 69.0, 70.0, 70.0, 71.0, 71.0, 72.0, 72.0, 72.0, 73.0, 73.0, 74.0, 74.0, 75.0, 75.0, 75.0, 76.0, 76.0, 77.0, 77.0, 77.0, 78.0, 78.0, 79.0, 79.0, 80.0, 80.0, 80.0, 81.0, 81.0, 81.0, 82.0, 82.0, 83.0, 83.0, 83.0, 84.0, 84.0, 84.0, 85.0, 85.0, 85.0, 86.0, 86.0, 86.0, 87.0, 87.0, 87.0, 88.0, 88.0, 88.0, 89.0, 89.0, 89.0, 90.0, 90.0, 90.0, 91.0, 91.0, 92.0, 92.0, 92.0, 93.0, 93.0, 93.0, 94.0, 94.0, 94.0, 95.0, 95.0, 95.0, 95.0, 96.0, 96.0, 96.0, 97.0, 97.0, 97.0, 97.0, 98.0, 98.0, 98.0, 98.0, 99.0, 99.0, 99.0, 99.0, 100.0, 100.0, 100.0, 101.0, 101.0, 101.0, 101.0, 102.0, 102.0, 102.0, 102.0, 103.0, 103.0, 103.0, 103.0, 104.0, 104.0, 104.0, 104.0, 105.0, 105.0, 105.0, 106.0, 106.0, 106.0, 107.0, 107.0, 107.0, 108.0, 108.0, 108.0, 109.0, 109.0, 109.0, 110.0, 110.0, 110.0, 111.0, 111.0, 112.0, 112.0, 113.0, 113.0, 114.0, 114.0, 115.0, 115.0, 116.0, 116.0, 117.0, 118.0, 118.0, 119.0, 120.0, 120.0, 121.0, 122.0, 123.0, 124.0, 125.0, 126.0, 127.0, 128.0, 129.0, 131.0, 132.0, 133.0, 134.0, 135.0, 136.0, 138.0, 139.0, 140.0, 141.0, 143.0, 144.0, 145.0, 146.0, 148.0, 149.0, 150.0, 151.0, 152.0, 154.0, 155.0, 156.0, 158.0, 159.0, 160.0, 161.0, 162.0, 163.0, 165.0, 166.0, 167.0, 168.0, 169.0, 170.0, 171.0, 172.0, 173.0, 173.0, 174.0, 175.0, 176.0, 177.0, 179.0, 180.0, 181.0, 182.0, 183.0, 184.0, 184.0, 185.0, 186.0, 186.0, 187.0, 188.0, 188.0, 189.0, 190.0, 190.0, 191.0, 192.0, 192.0, 193.0, 193.0, 194.0, 195.0, 195.0, 196.0, 197.0, 197.0, 198.0, 199.0, 200.0, 200.0, 201.0, 202.0, 203.0, 204.0, 204.0, 205.0, 206.0, 207.0, 208.0, 209.0, 210.0, 211.0, 212.0, 213.0, 214.0, 215.0, 216.0, 217.0, 218.0, 219.0, 220.0, 221.0, 222.0, 223.0, 224.0, 226.0, 227.0, 228.0, 229.0, 230.0, 231.0, 232.0, 234.0, 235.0, 236.0, 237.0, 238.0, 239.0, 240.0, 241.0, 243.0, 244.0, 245.0, 246.0, 247.0, 248.0, 249.0, 250.0, 251.0, 252.0, 253.0, 254.0, 255.0, 256.0, 257.0, 258.0, 259.0, 260.0, 261.0, 262.0, 263.0, 264.0, 264.0, 265.0, 266.0, 267.0, 268.0, 268.0, 269.0, 270.0, 271.0, 271.0, 272.0, 273.0, 273.0, 274.0, 275.0, 275.0, 276.0, 276.0, 277.0, 278.0, 278.0, 279.0, 279.0, 280.0, 280.0, 281.0, 281.0, 282.0, 283.0, 283.0, 284.0, 284.0, 285.0, 285.0, 286.0, 286.0, 287.0, 287.0, 288.0, 288.0, 289.0, 289.0, 290.0, 290.0, 291.0, 291.0, 292.0, 293.0, 293.0, 294.0, 294.0, 295.0, 295.0, 296.0, 297.0, 297.0, 298.0, 298.0, 299.0, 299.0, 300.0, 300.0, 301.0, 301.0, 302.0, 302.0, 303.0, 304.0, 304.0, 305.0, 305.0, 306.0, 306.0, 307.0, 307.0, 308.0, 309.0, 309.0, 310.0, 310.0, 311.0, 311.0, 312.0, 312.0, 313.0, 314.0, 314.0, 315.0, 315.0, 316.0, 316.0, 317.0, 317.0, 318.0, 318.0, 319.0, 319.0, 320.0, 320.0, 321.0, 321.0 ], "yaxis": "y", "type": "scattergl" }, { "hovertemplate": "Continent=Africa
    Date=%{x}
    Total Deaths per Million=%{y}", "legendgroup": "Africa", "line": { "color": "#FFA15A", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "Africa", "showlegend": true, "x": [ "2020-02-23", "2020-02-24", "2020-02-25", "2020-02-26", "2020-02-27", "2020-02-28", "2020-02-29", "2020-03-01", "2020-03-02", "2020-03-03", "2020-03-04", "2020-03-05", "2020-03-06", "2020-03-07", "2020-03-08", "2020-03-09", "2020-03-10", "2020-03-11", "2020-03-12", "2020-03-13", "2020-03-14", "2020-03-15", "2020-03-16", "2020-03-17", "2020-03-18", "2020-03-19", "2020-03-20", "2020-03-21", "2020-03-22", "2020-03-23", "2020-03-24", "2020-03-25", "2020-03-26", "2020-03-27", "2020-03-28", "2020-03-29", "2020-03-30", "2020-03-31", "2020-04-01", "2020-04-02", "2020-04-03", "2020-04-04", "2020-04-05", "2020-04-06", "2020-04-07", "2020-04-08", "2020-04-09", "2020-04-10", "2020-04-11", "2020-04-12", "2020-04-13", "2020-04-14", "2020-04-15", "2020-04-16", "2020-04-17", "2020-04-18", "2020-04-19", "2020-04-20", "2020-04-21", "2020-04-22", "2020-04-23", "2020-04-24", "2020-04-25", "2020-04-26", "2020-04-27", "2020-04-28", "2020-04-29", "2020-04-30", "2020-05-01", "2020-05-02", "2020-05-03", "2020-05-04", "2020-05-05", "2020-05-06", "2020-05-07", "2020-05-08", "2020-05-09", "2020-05-10", "2020-05-11", "2020-05-12", "2020-05-13", "2020-05-14", "2020-05-15", "2020-05-16", "2020-05-17", "2020-05-18", "2020-05-19", "2020-05-20", "2020-05-21", "2020-05-22", "2020-05-23", "2020-05-24", "2020-05-25", "2020-05-26", "2020-05-27", "2020-05-28", "2020-05-29", "2020-05-30", "2020-05-31", "2020-06-01", "2020-06-02", "2020-06-03", "2020-06-04", "2020-06-05", "2020-06-06", "2020-06-07", "2020-06-08", "2020-06-09", "2020-06-10", "2020-06-11", "2020-06-12", "2020-06-13", "2020-06-14", "2020-06-15", "2020-06-16", "2020-06-17", "2020-06-18", "2020-06-19", "2020-06-20", "2020-06-21", "2020-06-22", "2020-06-23", "2020-06-24", "2020-06-25", "2020-06-26", "2020-06-27", "2020-06-28", "2020-06-29", "2020-06-30", "2020-07-01", "2020-07-02", "2020-07-03", "2020-07-04", "2020-07-05", "2020-07-06", "2020-07-07", "2020-07-08", "2020-07-09", "2020-07-10", "2020-07-11", "2020-07-12", "2020-07-13", "2020-07-14", "2020-07-15", "2020-07-16", "2020-07-17", "2020-07-18", "2020-07-19", "2020-07-20", "2020-07-21", "2020-07-22", "2020-07-23", "2020-07-24", "2020-07-25", "2020-07-26", "2020-07-27", "2020-07-28", "2020-07-29", "2020-07-30", "2020-07-31", "2020-08-01", "2020-08-02", "2020-08-03", "2020-08-04", "2020-08-05", "2020-08-06", "2020-08-07", "2020-08-08", "2020-08-09", "2020-08-10", "2020-08-11", "2020-08-12", "2020-08-13", "2020-08-14", "2020-08-15", "2020-08-16", "2020-08-17", "2020-08-18", "2020-08-19", "2020-08-20", "2020-08-21", "2020-08-22", "2020-08-23", "2020-08-24", "2020-08-25", "2020-08-26", "2020-08-27", "2020-08-28", "2020-08-29", "2020-08-30", "2020-08-31", "2020-09-01", "2020-09-02", "2020-09-03", "2020-09-04", "2020-09-05", "2020-09-06", "2020-09-07", "2020-09-08", "2020-09-09", "2020-09-10", "2020-09-11", "2020-09-12", "2020-09-13", "2020-09-14", "2020-09-15", "2020-09-16", "2020-09-17", "2020-09-18", "2020-09-19", "2020-09-20", "2020-09-21", "2020-09-22", "2020-09-23", "2020-09-24", "2020-09-25", "2020-09-26", "2020-09-27", "2020-09-28", "2020-09-29", "2020-09-30", "2020-10-01", "2020-10-02", "2020-10-03", "2020-10-04", "2020-10-05", "2020-10-06", "2020-10-07", "2020-10-08", "2020-10-09", "2020-10-10", "2020-10-11", "2020-10-12", "2020-10-13", "2020-10-14", "2020-10-15", "2020-10-16", "2020-10-17", "2020-10-18", "2020-10-19", "2020-10-20", "2020-10-21", "2020-10-22", "2020-10-23", "2020-10-24", "2020-10-25", "2020-10-26", "2020-10-27", "2020-10-28", "2020-10-29", "2020-10-30", "2020-10-31", "2020-11-01", "2020-11-02", "2020-11-03", "2020-11-04", "2020-11-05", "2020-11-06", "2020-11-07", "2020-11-08", "2020-11-09", "2020-11-10", "2020-11-11", "2020-11-12", "2020-11-13", "2020-11-14", "2020-11-15", "2020-11-16", "2020-11-17", "2020-11-18", "2020-11-19", "2020-11-20", "2020-11-21", "2020-11-22", "2020-11-23", "2020-11-24", "2020-11-25", "2020-11-26", "2020-11-27", "2020-11-28", "2020-11-29", "2020-11-30", "2020-12-01", "2020-12-02", "2020-12-03", "2020-12-04", "2020-12-05", "2020-12-06", "2020-12-07", "2020-12-08", "2020-12-09", "2020-12-10", "2020-12-11", "2020-12-12", "2020-12-13", "2020-12-14", "2020-12-15", "2020-12-16", "2020-12-17", "2020-12-18", "2020-12-19", "2020-12-20", "2020-12-21", "2020-12-22", "2020-12-23", "2020-12-24", "2020-12-25", "2020-12-26", "2020-12-27", "2020-12-28", "2020-12-29", "2020-12-30", "2020-12-31", "2021-01-01", "2021-01-02", "2021-01-03", "2021-01-04", "2021-01-05", "2021-01-06", "2021-01-07", "2021-01-08", "2021-01-09", "2021-01-10", "2021-01-11", "2021-01-12", "2021-01-13", "2021-01-14", "2021-01-15", "2021-01-16", "2021-01-17", "2021-01-18", "2021-01-19", "2021-01-20", "2021-01-21", "2021-01-22", "2021-01-23", "2021-01-24", "2021-01-25", "2021-01-26", "2021-01-27", "2021-01-28", "2021-01-29", "2021-01-30", "2021-01-31", "2021-02-01", "2021-02-02", "2021-02-03", "2021-02-04", "2021-02-05", "2021-02-06", "2021-02-07", "2021-02-08", "2021-02-09", "2021-02-10", "2021-02-11", "2021-02-12", "2021-02-13", "2021-02-14", "2021-02-15", "2021-02-16", "2021-02-17", "2021-02-18", "2021-02-19", "2021-02-20", "2021-02-21", "2021-02-22", "2021-02-23", "2021-02-24", "2021-02-25", "2021-02-26", "2021-02-27", "2021-02-28", "2021-03-01", "2021-03-02", "2021-03-03", "2021-03-04", "2021-03-05", "2021-03-06", "2021-03-07", "2021-03-08", "2021-03-09", "2021-03-10", "2021-03-11", "2021-03-12", "2021-03-13", "2021-03-14", "2021-03-15", "2021-03-16", "2021-03-17", "2021-03-18", "2021-03-19", "2021-03-20", "2021-03-21", "2021-03-22", "2021-03-23", "2021-03-24", "2021-03-25", "2021-03-26", "2021-03-27", "2021-03-28", "2021-03-29", "2021-03-30", "2021-03-31", "2021-04-01", "2021-04-02", "2021-04-03", "2021-04-04", "2021-04-05", "2021-04-06", "2021-04-07", "2021-04-08", "2021-04-09", "2021-04-10", "2021-04-11", "2021-04-12", "2021-04-13", "2021-04-14", "2021-04-15", "2021-04-16", "2021-04-17", "2021-04-18", "2021-04-19", "2021-04-20", "2021-04-21", "2021-04-22", "2021-04-23", "2021-04-24", "2021-04-25", "2021-04-26", "2021-04-27", "2021-04-28", "2021-04-29", "2021-04-30", "2021-05-01", "2021-05-02", "2021-05-03", "2021-05-04", "2021-05-05", "2021-05-06", "2021-05-07", "2021-05-08", "2021-05-09", "2021-05-10", "2021-05-11", "2021-05-12", "2021-05-13", "2021-05-14", "2021-05-15", "2021-05-16", "2021-05-17", "2021-05-18", "2021-05-19", "2021-05-20", "2021-05-21", "2021-05-22", "2021-05-23", "2021-05-24", "2021-05-25", "2021-05-26", "2021-05-27", "2021-05-28", "2021-05-29", "2021-05-30", "2021-05-31", "2021-06-01", "2021-06-02", "2021-06-03", "2021-06-04", "2021-06-05", "2021-06-06", "2021-06-07", "2021-06-08", "2021-06-09", "2021-06-10", "2021-06-11", "2021-06-12", "2021-06-13", "2021-06-14", "2021-06-15", "2021-06-16", "2021-06-17", "2021-06-18", "2021-06-19", "2021-06-20", "2021-06-21", "2021-06-22", "2021-06-23", "2021-06-24", "2021-06-25", "2021-06-26", "2021-06-27", "2021-06-28", "2021-06-29", "2021-06-30", "2021-07-01", "2021-07-02", "2021-07-03", "2021-07-04", "2021-07-05", "2021-07-06", "2021-07-07", "2021-07-08", "2021-07-09", "2021-07-10", "2021-07-11", "2021-07-12", "2021-07-13", "2021-07-14", "2021-07-15", "2021-07-16", "2021-07-17", "2021-07-18", "2021-07-19", "2021-07-20", "2021-07-21", "2021-07-22", "2021-07-23", "2021-07-24", "2021-07-25", "2021-07-26", "2021-07-27", "2021-07-28", "2021-07-29", "2021-07-30", "2021-07-31", "2021-08-01", "2021-08-02", "2021-08-03", "2021-08-04", "2021-08-05", "2021-08-06", "2021-08-07", "2021-08-08", "2021-08-09", "2021-08-10", "2021-08-11", "2021-08-12", "2021-08-13", "2021-08-14", "2021-08-15", "2021-08-16", "2021-08-17", "2021-08-18", "2021-08-19", "2021-08-20", "2021-08-21", "2021-08-22", "2021-08-23", "2021-08-24", "2021-08-25", "2021-08-26", "2021-08-27", "2021-08-28", "2021-08-29", "2021-08-30", "2021-08-31", "2021-09-01", "2021-09-02", "2021-09-03", "2021-09-04", "2021-09-05", "2021-09-06", "2021-09-07", "2021-09-08", "2021-09-09", "2021-09-10", "2021-09-11", "2021-09-12", "2021-09-13", "2021-09-14", "2021-09-15", "2021-09-16", "2021-09-17", "2021-09-18", "2021-09-19", "2021-09-20", "2021-09-21", "2021-09-22", "2021-09-23", "2021-09-24", "2021-09-25", "2021-09-26", "2021-09-27", "2021-09-28", "2021-09-29", "2021-09-30", "2021-10-01", "2021-10-02", "2021-10-03", "2021-10-04", "2021-10-05", "2021-10-06", "2021-10-07", "2021-10-08", "2021-10-09", "2021-10-10", "2021-10-11", "2021-10-12", "2021-10-13", "2021-10-14", "2021-10-15", "2021-10-16", "2021-10-17", "2021-10-18", "2021-10-19", "2021-10-20", "2021-10-21", "2021-10-22", "2021-10-23", "2021-10-24", "2021-10-25", "2021-10-26", "2021-10-27", "2021-10-28", "2021-10-29", "2021-10-30", "2021-10-31", "2021-11-01", "2021-11-02", "2021-11-03", "2021-11-04", "2021-11-05", "2021-11-06", "2021-11-07", "2021-11-08", "2021-11-09", "2021-11-10", "2021-11-11", "2021-11-12", "2021-11-13", "2021-11-14", "2021-11-15", "2021-11-16", "2021-11-17", "2021-11-18", "2021-11-19", "2021-11-20", "2021-11-21", "2021-11-22", "2021-11-23", "2021-11-24", "2021-11-25", "2021-11-26", "2021-11-27", "2021-11-28", "2021-11-29", "2021-11-30", "2021-12-01", "2021-12-02", "2021-12-03", "2021-12-04", "2021-12-05", "2021-12-06", "2021-12-07", "2021-12-08", "2021-12-09", "2021-12-10", "2021-12-11", "2021-12-12", "2021-12-13", "2021-12-14", "2021-12-15", "2021-12-16", "2021-12-17", "2021-12-18", "2021-12-19", "2021-12-20" ], "xaxis": "x", "y": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 8.0, 8.0, 8.0, 8.0, 8.0, 8.0, 9.0, 9.0, 9.0, 9.0, 9.0, 10.0, 10.0, 10.0, 10.0, 10.0, 11.0, 11.0, 11.0, 11.0, 11.0, 12.0, 12.0, 12.0, 13.0, 13.0, 13.0, 13.0, 14.0, 14.0, 14.0, 15.0, 15.0, 15.0, 15.0, 16.0, 16.0, 16.0, 17.0, 17.0, 17.0, 17.0, 18.0, 18.0, 18.0, 18.0, 19.0, 19.0, 19.0, 19.0, 20.0, 20.0, 20.0, 20.0, 20.0, 21.0, 21.0, 21.0, 21.0, 21.0, 22.0, 22.0, 22.0, 22.0, 22.0, 22.0, 23.0, 23.0, 23.0, 23.0, 23.0, 23.0, 24.0, 24.0, 24.0, 24.0, 24.0, 24.0, 24.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 27.0, 27.0, 27.0, 27.0, 27.0, 27.0, 28.0, 28.0, 28.0, 28.0, 28.0, 28.0, 29.0, 29.0, 29.0, 29.0, 29.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 31.0, 31.0, 31.0, 31.0, 31.0, 32.0, 32.0, 32.0, 32.0, 32.0, 33.0, 33.0, 33.0, 33.0, 34.0, 34.0, 34.0, 34.0, 35.0, 35.0, 35.0, 35.0, 36.0, 36.0, 36.0, 36.0, 36.0, 37.0, 37.0, 37.0, 37.0, 38.0, 38.0, 38.0, 38.0, 38.0, 39.0, 39.0, 39.0, 39.0, 39.0, 40.0, 40.0, 40.0, 41.0, 41.0, 41.0, 41.0, 42.0, 42.0, 42.0, 43.0, 43.0, 43.0, 43.0, 44.0, 44.0, 45.0, 45.0, 45.0, 46.0, 46.0, 47.0, 47.0, 48.0, 48.0, 49.0, 49.0, 50.0, 50.0, 51.0, 51.0, 52.0, 53.0, 53.0, 54.0, 54.0, 55.0, 56.0, 57.0, 57.0, 58.0, 58.0, 59.0, 60.0, 60.0, 61.0, 62.0, 62.0, 63.0, 63.0, 64.0, 65.0, 65.0, 66.0, 66.0, 67.0, 67.0, 68.0, 68.0, 69.0, 69.0, 69.0, 70.0, 70.0, 71.0, 71.0, 71.0, 72.0, 72.0, 72.0, 72.0, 73.0, 73.0, 73.0, 74.0, 74.0, 74.0, 74.0, 75.0, 75.0, 75.0, 75.0, 76.0, 76.0, 76.0, 76.0, 77.0, 77.0, 77.0, 77.0, 77.0, 78.0, 78.0, 78.0, 78.0, 78.0, 79.0, 79.0, 79.0, 79.0, 79.0, 80.0, 80.0, 80.0, 80.0, 81.0, 81.0, 81.0, 81.0, 81.0, 82.0, 82.0, 82.0, 82.0, 83.0, 83.0, 83.0, 83.0, 83.0, 83.0, 84.0, 84.0, 84.0, 84.0, 84.0, 85.0, 85.0, 85.0, 85.0, 86.0, 86.0, 86.0, 86.0, 86.0, 87.0, 87.0, 87.0, 87.0, 88.0, 88.0, 88.0, 88.0, 89.0, 89.0, 89.0, 89.0, 89.0, 90.0, 90.0, 90.0, 90.0, 90.0, 91.0, 91.0, 91.0, 91.0, 92.0, 92.0, 92.0, 92.0, 92.0, 93.0, 93.0, 93.0, 93.0, 93.0, 94.0, 94.0, 94.0, 94.0, 94.0, 95.0, 95.0, 95.0, 95.0, 95.0, 96.0, 96.0, 96.0, 96.0, 96.0, 97.0, 97.0, 97.0, 97.0, 98.0, 98.0, 98.0, 98.0, 99.0, 99.0, 99.0, 100.0, 100.0, 100.0, 101.0, 101.0, 101.0, 102.0, 102.0, 103.0, 103.0, 103.0, 104.0, 104.0, 105.0, 105.0, 106.0, 106.0, 107.0, 108.0, 108.0, 109.0, 110.0, 110.0, 111.0, 111.0, 112.0, 113.0, 113.0, 114.0, 115.0, 115.0, 116.0, 116.0, 117.0, 118.0, 118.0, 119.0, 120.0, 120.0, 121.0, 122.0, 123.0, 123.0, 124.0, 125.0, 125.0, 126.0, 127.0, 128.0, 128.0, 129.0, 129.0, 130.0, 130.0, 131.0, 132.0, 133.0, 133.0, 134.0, 134.0, 135.0, 136.0, 137.0, 137.0, 137.0, 138.0, 138.0, 139.0, 140.0, 140.0, 141.0, 142.0, 142.0, 143.0, 143.0, 144.0, 144.0, 145.0, 145.0, 145.0, 146.0, 146.0, 146.0, 147.0, 147.0, 148.0, 148.0, 148.0, 149.0, 149.0, 149.0, 150.0, 150.0, 150.0, 150.0, 151.0, 151.0, 151.0, 152.0, 152.0, 152.0, 153.0, 153.0, 153.0, 153.0, 154.0, 154.0, 155.0, 155.0, 155.0, 155.0, 155.0, 156.0, 156.0, 156.0, 156.0, 156.0, 156.0, 157.0, 157.0, 157.0, 157.0, 157.0, 157.0, 158.0, 158.0, 158.0, 158.0, 158.0, 158.0, 158.0, 159.0, 159.0, 159.0, 159.0, 159.0, 159.0, 159.0, 159.0, 160.0, 160.0, 160.0, 160.0, 160.0, 160.0, 160.0, 161.0, 161.0, 161.0, 161.0, 161.0, 161.0, 161.0, 161.0, 161.0, 161.0, 162.0, 162.0, 162.0, 162.0, 162.0, 162.0, 162.0, 162.0, 162.0, 162.0, 163.0, 163.0, 163.0, 163.0, 163.0, 163.0, 163.0, 163.0, 163.0, 163.0, 164.0, 164.0, 164.0, 164.0, 164.0, 164.0, 164.0, 164.0, 164.0, 164.0 ], "yaxis": "y", "type": "scattergl" }, { "hovertemplate": "Continent=Oceania
    Date=%{x}
    Total Deaths per Million=%{y}", "legendgroup": "Oceania", "line": { "color": "#19d3f3", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "Oceania", "showlegend": true, "x": [ "2020-02-23", "2020-02-24", "2020-02-25", "2020-02-26", "2020-02-27", "2020-02-28", "2020-02-29", "2020-03-01", "2020-03-02", "2020-03-03", "2020-03-04", "2020-03-05", "2020-03-06", "2020-03-07", "2020-03-08", "2020-03-09", "2020-03-10", "2020-03-11", "2020-03-12", "2020-03-13", "2020-03-14", "2020-03-15", "2020-03-16", "2020-03-17", "2020-03-18", "2020-03-19", "2020-03-20", "2020-03-21", "2020-03-22", "2020-03-23", "2020-03-24", "2020-03-25", "2020-03-26", "2020-03-27", "2020-03-28", "2020-03-29", "2020-03-30", "2020-03-31", "2020-04-01", "2020-04-02", "2020-04-03", "2020-04-04", "2020-04-05", "2020-04-06", "2020-04-07", "2020-04-08", "2020-04-09", "2020-04-10", "2020-04-11", "2020-04-12", "2020-04-13", "2020-04-14", "2020-04-15", "2020-04-16", "2020-04-17", "2020-04-18", "2020-04-19", "2020-04-20", "2020-04-21", "2020-04-22", "2020-04-23", "2020-04-24", "2020-04-25", "2020-04-26", "2020-04-27", "2020-04-28", "2020-04-29", "2020-04-30", "2020-05-01", "2020-05-02", "2020-05-03", "2020-05-04", "2020-05-05", "2020-05-06", "2020-05-07", "2020-05-08", "2020-05-09", "2020-05-10", "2020-05-11", "2020-05-12", "2020-05-13", "2020-05-14", "2020-05-15", "2020-05-16", "2020-05-17", "2020-05-18", "2020-05-19", "2020-05-20", "2020-05-21", "2020-05-22", "2020-05-23", "2020-05-24", "2020-05-25", "2020-05-26", "2020-05-27", "2020-05-28", "2020-05-29", "2020-05-30", "2020-05-31", "2020-06-01", "2020-06-02", "2020-06-03", "2020-06-04", "2020-06-05", "2020-06-06", "2020-06-07", "2020-06-08", "2020-06-09", "2020-06-10", "2020-06-11", "2020-06-12", "2020-06-13", "2020-06-14", "2020-06-15", "2020-06-16", "2020-06-17", "2020-06-18", "2020-06-19", "2020-06-20", "2020-06-21", "2020-06-22", "2020-06-23", "2020-06-24", "2020-06-25", "2020-06-26", "2020-06-27", "2020-06-28", "2020-06-29", "2020-06-30", "2020-07-01", "2020-07-02", "2020-07-03", "2020-07-04", "2020-07-05", "2020-07-06", "2020-07-07", "2020-07-08", "2020-07-09", "2020-07-10", "2020-07-11", "2020-07-12", "2020-07-13", "2020-07-14", "2020-07-15", "2020-07-16", "2020-07-17", "2020-07-18", "2020-07-19", "2020-07-20", "2020-07-21", "2020-07-22", "2020-07-23", "2020-07-24", "2020-07-25", "2020-07-26", "2020-07-27", "2020-07-28", "2020-07-29", "2020-07-30", "2020-07-31", "2020-08-01", "2020-08-02", "2020-08-03", "2020-08-04", "2020-08-05", "2020-08-06", "2020-08-07", "2020-08-08", "2020-08-09", "2020-08-10", "2020-08-11", "2020-08-12", "2020-08-13", "2020-08-14", "2020-08-15", "2020-08-16", "2020-08-17", "2020-08-18", "2020-08-19", "2020-08-20", "2020-08-21", "2020-08-22", "2020-08-23", "2020-08-24", "2020-08-25", "2020-08-26", "2020-08-27", "2020-08-28", "2020-08-29", "2020-08-30", "2020-08-31", "2020-09-01", "2020-09-02", "2020-09-03", "2020-09-04", "2020-09-05", "2020-09-06", "2020-09-07", "2020-09-08", "2020-09-09", "2020-09-10", "2020-09-11", "2020-09-12", "2020-09-13", "2020-09-14", "2020-09-15", "2020-09-16", "2020-09-17", "2020-09-18", "2020-09-19", "2020-09-20", "2020-09-21", "2020-09-22", "2020-09-23", "2020-09-24", "2020-09-25", "2020-09-26", "2020-09-27", "2020-09-28", "2020-09-29", "2020-09-30", "2020-10-01", "2020-10-02", "2020-10-03", "2020-10-04", "2020-10-05", "2020-10-06", "2020-10-07", "2020-10-08", "2020-10-09", "2020-10-10", "2020-10-11", "2020-10-12", "2020-10-13", "2020-10-14", "2020-10-15", "2020-10-16", "2020-10-17", "2020-10-18", "2020-10-19", "2020-10-20", "2020-10-21", "2020-10-22", "2020-10-23", "2020-10-24", "2020-10-25", "2020-10-26", "2020-10-27", "2020-10-28", "2020-10-29", "2020-10-30", "2020-10-31", "2020-11-01", "2020-11-02", "2020-11-03", "2020-11-04", "2020-11-05", "2020-11-06", "2020-11-07", "2020-11-08", "2020-11-09", "2020-11-10", "2020-11-11", "2020-11-12", "2020-11-13", "2020-11-14", "2020-11-15", "2020-11-16", "2020-11-17", "2020-11-18", "2020-11-19", "2020-11-20", "2020-11-21", "2020-11-22", "2020-11-23", "2020-11-24", "2020-11-25", "2020-11-26", "2020-11-27", "2020-11-28", "2020-11-29", "2020-11-30", "2020-12-01", "2020-12-02", "2020-12-03", "2020-12-04", "2020-12-05", "2020-12-06", "2020-12-07", "2020-12-08", "2020-12-09", "2020-12-10", "2020-12-11", "2020-12-12", "2020-12-13", "2020-12-14", "2020-12-15", "2020-12-16", "2020-12-17", "2020-12-18", "2020-12-19", "2020-12-20", "2020-12-21", "2020-12-22", "2020-12-23", "2020-12-24", "2020-12-25", "2020-12-26", "2020-12-27", "2020-12-28", "2020-12-29", "2020-12-30", "2020-12-31", "2021-01-01", "2021-01-02", "2021-01-03", "2021-01-04", "2021-01-05", "2021-01-06", "2021-01-07", "2021-01-08", "2021-01-09", "2021-01-10", "2021-01-11", "2021-01-12", "2021-01-13", "2021-01-14", "2021-01-15", "2021-01-16", "2021-01-17", "2021-01-18", "2021-01-19", "2021-01-20", "2021-01-21", "2021-01-22", "2021-01-23", "2021-01-24", "2021-01-25", "2021-01-26", "2021-01-27", "2021-01-28", "2021-01-29", "2021-01-30", "2021-01-31", "2021-02-01", "2021-02-02", "2021-02-03", "2021-02-04", "2021-02-05", "2021-02-06", "2021-02-07", "2021-02-08", "2021-02-09", "2021-02-10", "2021-02-11", "2021-02-12", "2021-02-13", "2021-02-14", "2021-02-15", "2021-02-16", "2021-02-17", "2021-02-18", "2021-02-19", "2021-02-20", "2021-02-21", "2021-02-22", "2021-02-23", "2021-02-24", "2021-02-25", "2021-02-26", "2021-02-27", "2021-02-28", "2021-03-01", "2021-03-02", "2021-03-03", "2021-03-04", "2021-03-05", "2021-03-06", "2021-03-07", "2021-03-08", "2021-03-09", "2021-03-10", "2021-03-11", "2021-03-12", "2021-03-13", "2021-03-14", "2021-03-15", "2021-03-16", "2021-03-17", "2021-03-18", "2021-03-19", "2021-03-20", "2021-03-21", "2021-03-22", "2021-03-23", "2021-03-24", "2021-03-25", "2021-03-26", "2021-03-27", "2021-03-28", "2021-03-29", "2021-03-30", "2021-03-31", "2021-04-01", "2021-04-02", "2021-04-03", "2021-04-04", "2021-04-05", "2021-04-06", "2021-04-07", "2021-04-08", "2021-04-09", "2021-04-10", "2021-04-11", "2021-04-12", "2021-04-13", "2021-04-14", "2021-04-15", "2021-04-16", "2021-04-17", "2021-04-18", "2021-04-19", "2021-04-20", "2021-04-21", "2021-04-22", "2021-04-23", "2021-04-24", "2021-04-25", "2021-04-26", "2021-04-27", "2021-04-28", "2021-04-29", "2021-04-30", "2021-05-01", "2021-05-02", "2021-05-03", "2021-05-04", "2021-05-05", "2021-05-06", "2021-05-07", "2021-05-08", "2021-05-09", "2021-05-10", "2021-05-11", "2021-05-12", "2021-05-13", "2021-05-14", "2021-05-15", "2021-05-16", "2021-05-17", "2021-05-18", "2021-05-19", "2021-05-20", "2021-05-21", "2021-05-22", "2021-05-23", "2021-05-24", "2021-05-25", "2021-05-26", "2021-05-27", "2021-05-28", "2021-05-29", "2021-05-30", "2021-05-31", "2021-06-01", "2021-06-02", "2021-06-03", "2021-06-04", "2021-06-05", "2021-06-06", "2021-06-07", "2021-06-08", "2021-06-09", "2021-06-10", "2021-06-11", "2021-06-12", "2021-06-13", "2021-06-14", "2021-06-15", "2021-06-16", "2021-06-17", "2021-06-18", "2021-06-19", "2021-06-20", "2021-06-21", "2021-06-22", "2021-06-23", "2021-06-24", "2021-06-25", "2021-06-26", "2021-06-27", "2021-06-28", "2021-06-29", "2021-06-30", "2021-07-01", "2021-07-02", "2021-07-03", "2021-07-04", "2021-07-05", "2021-07-06", "2021-07-07", "2021-07-08", "2021-07-09", "2021-07-10", "2021-07-11", "2021-07-12", "2021-07-13", "2021-07-14", "2021-07-15", "2021-07-16", "2021-07-17", "2021-07-18", "2021-07-19", "2021-07-20", "2021-07-21", "2021-07-22", "2021-07-23", "2021-07-24", "2021-07-25", "2021-07-26", "2021-07-27", "2021-07-28", "2021-07-29", "2021-07-30", "2021-07-31", "2021-08-01", "2021-08-02", "2021-08-03", "2021-08-04", "2021-08-05", "2021-08-06", "2021-08-07", "2021-08-08", "2021-08-09", "2021-08-10", "2021-08-11", "2021-08-12", "2021-08-13", "2021-08-14", "2021-08-15", "2021-08-16", "2021-08-17", "2021-08-18", "2021-08-19", "2021-08-20", "2021-08-21", "2021-08-22", "2021-08-23", "2021-08-24", "2021-08-25", "2021-08-26", "2021-08-27", "2021-08-28", "2021-08-29", "2021-08-30", "2021-08-31", "2021-09-01", "2021-09-02", "2021-09-03", "2021-09-04", "2021-09-05", "2021-09-06", "2021-09-07", "2021-09-08", "2021-09-09", "2021-09-10", "2021-09-11", "2021-09-12", "2021-09-13", "2021-09-14", "2021-09-15", "2021-09-16", "2021-09-17", "2021-09-18", "2021-09-19", "2021-09-20", "2021-09-21", "2021-09-22", "2021-09-23", "2021-09-24", "2021-09-25", "2021-09-26", "2021-09-27", "2021-09-28", "2021-09-29", "2021-09-30", "2021-10-01", "2021-10-02", "2021-10-03", "2021-10-04", "2021-10-05", "2021-10-06", "2021-10-07", "2021-10-08", "2021-10-09", "2021-10-10", "2021-10-11", "2021-10-12", "2021-10-13", "2021-10-14", "2021-10-15", "2021-10-16", "2021-10-17", "2021-10-18", "2021-10-19", "2021-10-20", "2021-10-21", "2021-10-22", "2021-10-23", "2021-10-24", "2021-10-25", "2021-10-26", "2021-10-27", "2021-10-28", "2021-10-29", "2021-10-30", "2021-10-31", "2021-11-01", "2021-11-02", "2021-11-03", "2021-11-04", "2021-11-05", "2021-11-06", "2021-11-07", "2021-11-08", "2021-11-09", "2021-11-10", "2021-11-11", "2021-11-12", "2021-11-13", "2021-11-14", "2021-11-15", "2021-11-16", "2021-11-17", "2021-11-18", "2021-11-19", "2021-11-20", "2021-11-21", "2021-11-22", "2021-11-23", "2021-11-24", "2021-11-25", "2021-11-26", "2021-11-27", "2021-11-28", "2021-11-29", "2021-11-30", "2021-12-01", "2021-12-02", "2021-12-03", "2021-12-04", "2021-12-05", "2021-12-06", "2021-12-07", "2021-12-08", "2021-12-09", "2021-12-10", "2021-12-11", "2021-12-12", "2021-12-13", "2021-12-14", "2021-12-15", "2021-12-16", "2021-12-17", "2021-12-18", "2021-12-19", "2021-12-20" ], "xaxis": "x", "y": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 5.0, 5.0, 5.0, 5.0, 5.0, 6.0, 6.0, 6.0, 7.0, 7.0, 7.0, 7.0, 8.0, 8.0, 9.0, 9.0, 9.0, 10.0, 10.0, 10.0, 11.0, 11.0, 11.0, 12.0, 12.0, 12.0, 13.0, 13.0, 13.0, 14.0, 14.0, 15.0, 15.0, 15.0, 16.0, 17.0, 17.0, 17.0, 18.0, 19.0, 19.0, 19.0, 19.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 21.0, 21.0, 21.0, 21.0, 21.0, 21.0, 21.0, 22.0, 22.0, 22.0, 22.0, 22.0, 22.0, 22.0, 22.0, 22.0, 22.0, 23.0, 23.0, 23.0, 23.0, 23.0, 23.0, 23.0, 23.0, 23.0, 23.0, 22.0, 22.0, 23.0, 23.0, 23.0, 23.0, 23.0, 23.0, 23.0, 23.0, 23.0, 23.0, 23.0, 23.0, 23.0, 23.0, 23.0, 23.0, 23.0, 23.0, 23.0, 23.0, 23.0, 23.0, 23.0, 23.0, 23.0, 23.0, 23.0, 23.0, 23.0, 23.0, 23.0, 23.0, 23.0, 23.0, 24.0, 23.0, 23.0, 23.0, 23.0, 23.0, 24.0, 24.0, 24.0, 24.0, 24.0, 24.0, 24.0, 24.0, 24.0, 24.0, 24.0, 24.0, 24.0, 24.0, 24.0, 24.0, 24.0, 24.0, 24.0, 24.0, 24.0, 24.0, 24.0, 24.0, 24.0, 24.0, 24.0, 24.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 27.0, 27.0, 27.0, 27.0, 27.0, 27.0, 27.0, 27.0, 27.0, 27.0, 27.0, 27.0, 27.0, 27.0, 27.0, 27.0, 27.0, 27.0, 27.0, 27.0, 27.0, 27.0, 27.0, 28.0, 28.0, 28.0, 28.0, 28.0, 28.0, 28.0, 28.0, 28.0, 28.0, 28.0, 28.0, 28.0, 28.0, 28.0, 28.0, 28.0, 28.0, 28.0, 28.0, 28.0, 28.0, 28.0, 28.0, 28.0, 28.0, 28.0, 28.0, 29.0, 29.0, 29.0, 29.0, 29.0, 29.0, 29.0, 29.0, 29.0, 29.0, 29.0, 29.0, 29.0, 29.0, 29.0, 29.0, 29.0, 29.0, 29.0, 29.0, 29.0, 29.0, 29.0, 29.0, 29.0, 29.0, 29.0, 29.0, 29.0, 29.0, 29.0, 29.0, 29.0, 29.0, 29.0, 29.0, 29.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 31.0, 31.0, 31.0, 31.0, 31.0, 31.0, 31.0, 31.0, 32.0, 32.0, 33.0, 33.0, 34.0, 34.0, 34.0, 34.0, 34.0, 35.0, 35.0, 35.0, 35.0, 36.0, 36.0, 36.0, 36.0, 37.0, 37.0, 37.0, 37.0, 38.0, 38.0, 39.0, 39.0, 39.0, 40.0, 40.0, 40.0, 42.0, 42.0, 43.0, 43.0, 44.0, 44.0, 44.0, 45.0, 46.0, 47.0, 48.0, 48.0, 48.0, 48.0, 50.0, 50.0, 51.0, 52.0, 52.0, 52.0, 52.0, 54.0, 54.0, 55.0, 55.0, 56.0, 56.0, 56.0, 57.0, 57.0, 58.0, 58.0, 59.0, 60.0, 60.0, 61.0, 61.0, 62.0, 63.0, 63.0, 64.0, 65.0, 65.0, 67.0, 67.0, 68.0, 69.0, 69.0, 70.0, 70.0, 71.0, 72.0, 73.0, 73.0, 74.0, 74.0, 75.0, 75.0, 77.0, 77.0, 77.0, 78.0, 78.0, 80.0, 80.0, 81.0, 81.0, 82.0, 83.0, 83.0, 83.0, 84.0, 84.0, 85.0, 86.0, 86.0, 86.0, 87.0, 87.0, 88.0, 88.0, 89.0, 89.0, 89.0, 90.0, 90.0, 90.0, 91.0, 91.0, 91.0, 92.0, 92.0, 92.0, 93.0, 93.0, 94.0, 95.0, 95.0, 96.0, 96.0, 97.0, 97.0, 97.0, 97.0, 97.0, 98.0, 98.0, 98.0, 98.0, 99.0, 99.0, 99.0, 99.0, 100.0, 100.0, 100.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 102.0, 102.0, 102.0, 102.0, 102.0 ], "yaxis": "y", "type": "scattergl" } ], "layout": { "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ], "sequentialminus": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "xaxis": { "anchor": "y", "domain": [ 0.0, 1.0 ], "title": { "text": "Date" } }, "yaxis": { "anchor": "x", "domain": [ 0.0, 1.0 ], "title": { "text": "Total Deaths per Million" } }, "legend": { "title": { "text": "Continent" }, "tracegroupgap": 0 }, "margin": { "t": 24, "b": 0 }, "paper_bgcolor": "rgba(0, 0, 0, 0)" } } ) }; ================================================ FILE: web/empty_script.py ================================================ # This is an empty Python script. # It is here, so it tricks GitHub into thinking that this is a Python project. # But because GitHub counts characters, we have to fill it with something. # How about: from math import sin, pi LEN = 40 wave = ['#' * (1 + round(amp * (1+sin(i/resolution*2*pi)))) for resolution, amp in zip(range(10, 10+LEN, 2), range(2, 2+LEN, 2)) for i in range(resolution)] print('\n'.join(wave)) # ## ### #### ##### ##### #### ### ## # # ## ##### ####### ######## ######### ######## ####### ##### ### ## # ## ### ####### ########## ############ ############# ############# ############ ########## ####### #### ## # # ## #### ######### ############ ############### ################ ################# ################ ############### ############ ######### ###### ### ## # ## ### ###### ########### ############## ################# #################### ##################### ##################### #################### ################# ############## ########### ######## ##### ## # # ## ##### ######## ############# ################# #################### ####################### ######################## ######################### ######################## ####################### #################### ################# ############# ######### ###### ### ## # ## ### ###### ######### ############### ################### ####################### ########################## ############################ ############################# ############################# ############################ ########################## ####################### ################### ############### ########### ####### #### ## # # ## #### ####### ########### ################# ##################### ######################### ############################ ############################### ################################ ################################# ################################ ############################### ############################ ######################### ##################### ################# ############# ######### ###### ### ## # ## ### ###### ######### ############# ################### ####################### ########################### ############################### ################################## #################################### ##################################### ##################################### #################################### ################################## ############################### ########################### ####################### ################### ############### ########### ####### #### ## # # ## #### ####### ########### ############### ##################### ######################### ############################## ################################# ##################################### ####################################### ######################################## ######################################### ######################################## ####################################### ##################################### ################################# ############################## ######################### ##################### ################# ############ ######### ##### ### ## # ## ### ##### ######### ############ ################# ####################### ############################ ################################ #################################### ####################################### ########################################## ############################################ ############################################# ############################################# ############################################ ########################################## ####################################### #################################### ################################ ############################ ####################### ################## ############## ########## ####### #### ## # # ## #### ####### ########## ############## ################## ######################### ############################## ################################## ###################################### ########################################## ############################################# ############################################### ################################################# ################################################# ################################################# ############################################### ############################################# ########################################## ###################################### ################################## ############################## ######################### #################### ################ ############ ######## ##### ### # # # ### ##### ######## ############ ################ #################### ########################### ################################ #################################### ######################################### ############################################# ################################################ ################################################## #################################################### ##################################################### ##################################################### #################################################### ################################################## ################################################ ############################################# ######################################### #################################### ################################ ########################### ###################### ################## ############# ######### ###### #### ## # # ## #### ###### ######### ############# ################## ###################### ############################# ################################## ####################################### ########################################### ############################################### ################################################## ##################################################### ####################################################### ######################################################### ######################################################### ######################################################### ####################################################### ##################################################### ################################################## ############################################### ########################################### ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### # # # ### ##### ######## ########### ############### ################### ######################## ############################### #################################### ######################################### ############################################# ################################################# ##################################################### ######################################################## ########################################################## ############################################################ ############################################################# ############################################################# ############################################################ ########################################################## ######################################################## ##################################################### ################################################# ############################################# ######################################### #################################### ############################### ########################## ##################### ################# ############# ######### ###### #### ## # # ## #### ###### ######### ############# ################# ##################### ########################## ################################# ###################################### ########################################### ################################################ #################################################### ######################################################## ########################################################### ############################################################## ############################################################### ################################################################# ################################################################# ################################################################# ############################################################### ############################################################## ########################################################### ######################################################## #################################################### ################################################ ########################################### ###################################### ################################# ############################ ####################### ################## ############## ########## ####### #### ### # # # ### #### ####### ########## ############## ################## ####################### ############################ ################################### ######################################## ############################################# ################################################## ###################################################### ########################################################## ############################################################## ################################################################ ################################################################### #################################################################### ##################################################################### ##################################################################### #################################################################### ################################################################### ################################################################ ############################################################## ########################################################## ###################################################### ################################################## ############################################# ######################################## ################################### ############################## ######################### #################### ################ ############ ######## ###### ### ## # # ## ### ###### ######## ############ ################ #################### ######################### ############################## ##################################### ########################################## ############################################### #################################################### ######################################################## ############################################################# ################################################################ ################################################################### ###################################################################### ######################################################################## ######################################################################### ######################################################################### ######################################################################### ######################################################################## ###################################################################### ################################################################### ################################################################ ############################################################# ######################################################## #################################################### ############################################### ########################################## ##################################### ################################ ########################### ###################### ################## ############# ########## ####### #### ## # # # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # # # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # # # # # # # # # # # # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # # # # # # # # # # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # # ## ### #### ####### ########## ############# ################## ###################### ########################### ################################ ####################################### ############################################ ################################################# ###################################################### ########################################################### ############################################################### ################################################################### ###################################################################### ######################################################################### ########################################################################### ############################################################################ ############################################################################# ############################################################################# ############################################################################ ########################################################################### ######################################################################### ###################################################################### ################################################################### ############################################################### ########################################################### ###################################################### ################################################# ############################################ ####################################### ################################## ############################# ######################## ################### ############### ########### ######## ##### ### ## # ================================================ FILE: web/faq.html ================================================
    Which Python version is this for?
        Everything should work in the latest Python version, which is 3.12. Every feature that requires version higher than 3.9 has that mentioned in comments or brackets. There are only two such features, both requiring 3.10.

        As of 12th March 2024, the only libraries whose latest version requires Python version higher than 3.8 are: numpy, pandas and matplotlib. They all require Python 3.9. This cheatsheet covers numpy version 2.0 (or higher) that was released on 16th June, 2024 and pandas version 2.0 (or higher) that was released on 3rd April 2023.

    How to use it?
        This cheatsheet consists of minimal text and short examples so things are easy to find with Ctrl+F / ⌘F. If you're on the webpage, searching for '#<name>' will only search for the titles. To get a link to a specific section click the grey hashtag next to the section's title before copying the address. To search for titles in the text editor use ^<name> with enabled regular expressions option.

        I also keep the Python console open at all times to test little snippets of code, to check out the available functions of a module using code completion and above all, to use help(<module/object/function/type/str>) command. If something is still unclear, then I search the Python docs by googling 'python docs <module/function>'.

        Recently I started using the ptpython REPL (Python console). It supports multiline editing, syntax validation, IDE-like autocompletion and syntax highlighting. It can be installed with pip3 install ptpython. Even more recently I switched to ipython REPL, which is very similar to ptpython only more responsive. It can be installed with pip3 install ipython.

    What does the '<type>' signify?
        It is a placeholder for an object. It needs to be replaced by an expression, literal or a variable that returns/is of that type. However, if it is located on the left side of an assignment (=) then it signifies what type of object is produced/returned by the expression on the right side of the assignment.

    Why the '<type>' semantics?
        It makes examples much less ambiguous.

    What exactly is <el>?
        El is short for element and can be any object, but it usually denotes an object that is an item of a collection.

    What exactly is <collection>?
        Collection is my name for an iterable object. An iterable object in Python is any object that has at least one of iter() and getitem() special methods defined. By convention, <object>.__iter__() should return an iterator of object's items and <object>.__getitem__(<index>) an item at that index. I chose not to use the name iterable because it sounds scarier and more vague than collection, even though it has a precise definition.

        To make matters a bit more confusing, an abstract base class called Iterable doesn't fully follow this definition. An expression instanceof(<object>, collections.abc.Iterable) only checks whether an object has iter() special method, disregarding the getitem().

        Although collection has no definition in Python's glossary, there exists a Collection abstract base class. Expression instanceof(<object>, collections.abc.Collection) returns 'True' for any object that has len(), iter() and contains() special methods defined. <object>.__len__() should return the number of elements and <object>.__contains__(<el>) should check if object contains the passed element.

    What about PEP 8?
        Check out Google Style Guide and use Ctrl+Alt+L / ⌥⌘L shortcut in PyCharm to automatically reformat code.

    Why are there no blank lines between method definitions?
        This way classes can be copy-pasted into the Python console, which would otherwise raise IndentationError.

    Why are tests not covered?
        Check out The Hitchhiker’s Guide to Python for a nice overview.

    Django?
        Here is a nice Django cheatsheet.

    Why are there no concrete Regex examples?
        Regular expressions are a separate technology that is independent from Python. There are many resources available online.

    Why are descriptors not covered?
        Because property decorator is sufficient for everyday use.

    ================================================ FILE: web/script_2.js ================================================ const TOC = '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\': [Function, Inline, Import, Decorator, Class, Duck_Type, Enum, Except],\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\': [Operator, Match_Statement, Logging, Introspection, Threads, Asyncio],\n' + ' \'7. Libraries\': [Progress_Bar, Plot, Table, Console_App, GUI, Scraping, Web, Profile],\n' + ' \'8. Multimedia\': [NumPy, Image, Animation, Audio, Synthesizer, Pygame, Pandas, Plotly]\n' + '}\n'; const TOC_MOBILE = 'ToC = {\n' + ' \'1. Collections\': [List, Dictionary, Set,\n' + ' Tuple, Range, Enumerate,\n' + ' Iterator, Generator],\n' + ' \'2. Types\': [Type, String, Regular_Exp,\n' + ' Format, Numbers,\n' + ' Combinatorics, Datetime],\n' + ' \'3. Syntax\': [Function, Inline, Import,\n' + ' Decorator, Class,\n' + ' Duck_Types, Enum, Except],\n' + ' \'4. System\': [Exit, Print, Input,\n' + ' Command_Line_Arguments,\n' + ' Open, Paths, OS_Commands],\n' + ' \'5. Data\': [JSON, Pickle, CSV, SQLite,\n' + ' Bytes, Struct, Array,\n' + ' Memory_View, Deque],\n' + ' \'6. Advanced\': [Operator, Match_Statement,\n' + ' Logging, Introspection,\n' + ' Threading, Asyncio],\n' + ' \'7. Libraries\': [Progress_Bar, Plot, Table,\n' + ' Console_App, GUI_App,\n' + ' Scraping, Web, Profiling],\n' + ' \'8. Multimedia\': [NumPy, Image, Animation,\n' + ' Audio, Synthesizer,\n' + ' Pygame, Pandas, Plotly]\n' + '}\n'; var iOS = /iPhone|iPod/.test(navigator.userAgent) && !window.MSStream; if (iOS) { var viewport_meta = document.getElementById('viewport-meta'); viewport_meta.setAttribute('content', "initial-scale=0.55"); } var isMobile = false; // Device detection: if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.substr(0,4))) { isMobile = true; } var TOC_SCREEN_WIDTH_CUTOFF = 667 var TOC_EM = '2em' var TOC_EM_DESKTOP = '1.327em' var PLOTLY_WIDTH_DESKTOP = 914 function switch_to_mobile_view() { $(`code:contains(ToC)`).html(TOC_MOBILE).css("line-height", TOC_EM); const body = document.querySelector("body"); body.style["width"] = `${TOC_SCREEN_WIDTH_CUTOFF+9}px`; const plotlyDivs = document.querySelectorAll(".plotly-graph-div"); plotlyDivs.forEach((div) => { div.style["width"] = `${TOC_SCREEN_WIDTH_CUTOFF}px`; }); } function switch_to_desktop_view() { $(`code:contains(ToC)`).html(TOC).css("line-height", TOC_EM_DESKTOP); const body = document.querySelector("body"); body.style["width"] = ""; const plotlyDivs = document.querySelectorAll(".plotly-graph-div"); plotlyDivs.forEach((div) => { div.style["width"] = `${PLOTLY_WIDTH_DESKTOP}px`; }); } if (isMobile && window.screen.width < TOC_SCREEN_WIDTH_CUTOFF) { switch_to_mobile_view() } function updateToc() { if (isMobile && window.screen.width < TOC_SCREEN_WIDTH_CUTOFF) { switch_to_mobile_view(); } else { switch_to_desktop_view(); } } window.addEventListener("orientationchange", updateToc, false); // ===== Scroll to Top ==== $(window).scroll(function() { if (isMobile && $(this).scrollTop() >= 480) { // If mobile device and page is scrolled more than 520px. $('#return-to-top').fadeIn(200); // Fade in the arrow } else { $('#return-to-top').fadeOut(200); // Else fade out the arrow } }); $('#return-to-top').click(function() { // When arrow is clicked $('body,html').animate({ scrollTop : 0 // Scroll to top of body }, 500); }); ================================================ FILE: web/style.css ================================================ /* Copyright 2013 Michael Bostock. All rights reserved. Do not copy. */ @import url(https://fonts.googleapis.com/css?family=PT+Serif|PT+Serif:b|PT+Serif:i|PT+Serif:bolditalic|PT+Sans|PT+Sans:b); .ocks-org body { background: #fcfcfa; color: #333; font-family: "PT Serif", serif; margin: 1em auto 4em auto; position: relative; width: 960px; padding: 1rem; } .ocks-org header, .ocks-org footer, .ocks-org aside, .ocks-org h1, .ocks-org h2, .ocks-org h3, .ocks-org h4 { font-family: "PT Sans", sans-serif; } .ocks-org h1, .ocks-org h2, .ocks-org h3, .ocks-org h4 { color: #000; } .ocks-org header, .ocks-org footer { color: #636363; } h1 { font-size: 64px; font-weight: 300; letter-spacing: -2px; margin: 0.3em 0 0.1em 0; } h2 { margin-top: 2em; } h1, h2 { text-rendering: optimizeLegibility; } h2 a[name], h2 a[id] { color: #ccc; padding-right: 0.3em; } header, footer { font-size: small; } .ocks-org header aside, .ocks-org footer aside { float: left; margin-right: 0.5em; } .ocks-org header aside:after, .ocks-org footer aside:after { padding-left: 0.5em; content: "/"; } footer { margin-top: 6em; } h1 ~ aside { font-size: small; right: 0; position: absolute; width: 180px; } .attribution { font-size: small; margin-bottom: 2em; } body > p, li > p, div > p { line-height: 1.5em; } body > p, div > p { width: 720px; } body > blockquote { width: 640px; } blockquote q { display: block; font-style: oblique; } ul { padding: 0; } li { width: 690px; margin-left: 30px; } a { color: steelblue; } a:not(:hover) { text-decoration: none; } pre, code, textarea { font-family: "Menlo", "Menlo Web", "Menlo Web ss", monospace; } code { line-height: 1em; } textarea { font-size: 100%; } pre { border-left: solid 2px #ccc; padding-left: 18px; margin: 2em 0 2em 0; } .html .value, .javascript .string, .javascript .regexp { color: #756bb1; } .html .tag, .css .tag, .javascript .keyword { color: #3182bd; } .comment { color: #636363; } .html .doctype, .javascript .number { color: #31a354; } .html .attribute, .css .attribute, .javascript .class, .javascript .special { color: #e6550d; } svg { font: 10px sans-serif; } .axis path, .axis line { fill: none; stroke: #000; shape-rendering: crispEdges; } sup, sub { line-height: 0; } q:before { content: "“"; } q:after { content: "”"; } blockquote q { line-height: 1.5em; display: inline; } blockquote q:before, blockquote q:after { content: ""; } h3, h4, p, ul { padding-left: 1.2rem; } .banner { padding: 0; } #toc { margin-top: 0; } @media only screen and (max-device-width: 1023px) { .ocks-org body { font-size: 72%; padding: 0.5rem; } body > p, div > p { width: 90vw !important; } li { width: 82vw; } h3, h4, p, ul { padding-left: .7rem; width: 90vw; } h1 { font-size: 2rem; } pre { padding-left: 0.5rem; } .banner, h1, img { max-width: calc(100vw - 2em); min-width: calc(100vw - 2em); } } /*@import url(web/style.css);*/ @font-face {font-family: "Menlo web"; src: url("OnlineWebFonts_COM_cb7eb796ae7de7195a34c485cacebad1\\@font-face\\9f94dc20bb2a09c15241d3a880b7ad01.woff2") format("woff2"), /* chrome、firefox */ url("OnlineWebFonts_COM_cb7eb796ae7de7195a34c485cacebad1\\@font-face\\9f94dc20bb2a09c15241d3a880b7ad01.woff") format("woff"); font-weight: normal; } @font-face {font-family: "Menlo web"; src: url("OnlineWebFonts_COM_d6ba633f6ea4cafe1a39ab736fe55e88\\Menlo Bold\\@font-face\\a6ffc5d72a96b65159e710ea6d258ba4.woff2") format("woff2"), /* chrome、firefox */ url("OnlineWebFonts_COM_d6ba633f6ea4cafe1a39ab736fe55e88\\Menlo Bold\\@font-face\\a6ffc5d72a96b65159e710ea6d258ba4.woff") format("woff"); font-weight: bold; } @font-face {font-family: "Menlo web ss"; src: url("OnlineWebFonts_COM_cb7eb796ae7de7195a34c485cacebad1\\@font-face\\9f94dc20bb2a09c15241d3a880b7ad01-ss2.woff") format("woff"); font-weight: normal; } @font-face {font-family: "PT Serif"; src: url("fonts\\EJRSQgYoZZY2vCFuvAnt66qSVys.woff2") format("woff2"); font-weight: bold; } .join, .link, .node rect { fill: none; stroke: #636363; stroke-width: 1.5px; } .link { stroke: #969696; } .node rect { fill: white; } .link path, .node rect, .node text, .join { -webkit-transition: stroke-opacity 500ms linear, fill-opacity 500ms linear; -moz-transition: stroke-opacity 500ms linear, fill-opacity 500ms linear; -ms-transition: stroke-opacity 500ms linear, fill-opacity 500ms linear; -o-transition: stroke-opacity 500ms linear, fill-opacity 500ms linear; transition: stroke-opacity 500ms linear, fill-opacity 500ms linear; } .node .element rect { fill: #bdbdbd; stroke: none; } .node .null rect { fill: none; stroke: none; } .node .null text { fill: #636363; } .node .selection rect { stroke: #e6550d; } .node .data rect { stroke: #3182bd; } .node .datum rect { fill: #d9d9d9; stroke: none; } .node .code text { font-family: monospace; } .node .key rect { fill: #a1d99b; stroke: none; } .link .to-key, .join { stroke: #a1d99b; } .join { stroke-dasharray: 2,2; } .link .to-null { stroke-dasharray: .5,3.5; stroke-linecap: round; } .link .from-data { stroke: #3182bd; } .play circle { fill: #fff; stroke: #000; stroke-width: 3px; } .play:hover path { fill: #f00; } .play.mousedown circle { fill: #f00; } .play.mousedown path { fill: #fff; } .play rect { fill: none; pointer-events: all; cursor: pointer; } code span { -webkit-transition: background 250ms linear; -moz-transition: background 250ms linear; -ms-transition: background 250ms linear; -o-transition: background 250ms linear; transition: background 250ms linear; } pre.prettyprint, code.prettyprint { background-color: #222; border-radius: 8px; font-size: 15px; } pre.prettyprint { width: 90%; margin: 0.5em; padding: 1em; white-space: pre-wrap; } #return-to-top { position: fixed; bottom: 20px; right: 20px; background: rgb(0, 0, 0); background: rgba(0, 0, 0, 0.2); width: 50px; height: 50px; display: block; text-decoration: none; -webkit-border-radius: 35px; -moz-border-radius: 35px; border-radius: 35px; display: none; -webkit-transition: all 0.3s linear; -moz-transition: all 0.3s ease; -ms-transition: all 0.3s ease; -o-transition: all 0.3s ease; transition: all 0.3s ease; } #return-to-top i { color: #fff; margin: 0; position: relative; left: 16px; top: 13px; font-size: 19px; -webkit-transition: all 0.3s ease; -moz-transition: all 0.3s ease; -ms-transition: all 0.3s ease; -o-transition: all 0.3s ease; transition: all 0.3s ease; } #return-to-top:hover { background: rgba(0, 0, 0, 0.35); } #return-to-top:hover i { color: #f0f0f0; } @media print { .pagebreak { page-break-before: always; } div { page-break-inside: avoid; } pre { page-break-inside: avoid; } } .modebar{ display: none !important; } ================================================ FILE: web/style_dark.css ================================================ /* Copyright 2013 Michael Bostock. All rights reserved. Do not copy. */ @import url(https://fonts.googleapis.com/css?family=PT+Serif|PT+Serif:b|PT+Serif:i|PT+Sans|PT+Sans:b); .ocks-org body { background: hsl(206deg 47% 9%); color: hsl(0deg 0% 72%); font-family: "PT Serif", serif; margin: 1em auto 4em auto; position: relative; width: 960px; padding: 1rem; } .ocks-org header, .ocks-org footer, .ocks-org aside, .ocks-org h1, .ocks-org h2, .ocks-org h3, .ocks-org h4 { font-family: "PT Sans", sans-serif; } .ocks-org h1, .ocks-org h2, .ocks-org h3, .ocks-org h4 { color: hsl(0deg 1% 71%); } .ocks-org header, .ocks-org footer { color: #636363; } h1 { font-size: 67px; font-weight: 300; letter-spacing: -2px; margin: 0.3em 0 0.1em 0; } h2 { margin-top: 2em; } h1, h2 { text-rendering: optimizeLegibility; } h2 a[name], h2 a[id] { color: hsl(0deg 0% 63% / 49%); padding-right: 0.3em; } header, footer { font-size: small; } .ocks-org header aside, .ocks-org footer aside { float: left; margin-right: 0.5em; } .ocks-org header aside:after, .ocks-org footer aside:after { padding-left: 0.5em; content: "/"; } footer { margin-top: 6em; } h1 ~ aside { font-size: small; right: 0; position: absolute; width: 180px; } .attribution { font-size: small; margin-bottom: 2em; } body > p, li > p, div > p { line-height: 1.5em; } body > p, div > p { width: 720px; } body > blockquote { width: 640px; } blockquote q { display: block; font-style: oblique; } ul { padding: 0; } li { width: 690px; margin-left: 30px; } a { color: steelblue; } a:not(:hover) { text-decoration: none; } pre, code, textarea { font-family: "Menlo", "Menlo Web", monospace; } code { line-height: 1em; } textarea { font-size: 100%; } pre { border-left: solid 2px hsl(206deg 34% 14%); padding-left: 18px; margin: 1em 0 1em 0; background: hsl(206deg 34% 14%); border-radius: 6px; padding-top: 16px; padding-bottom: 16px; } .html .value, .javascript .string, .javascript .regexp { color: #756bb1; } .html .tag, .css .tag, .javascript .keyword { color: #3182bd; } .comment { color: #636363; } .html .doctype, .javascript .number { color: #31a354; } .html .attribute, .css .attribute, .javascript .class, .javascript .special { color: #e6550d; } svg { font: 10px sans-serif; } .axis path, .axis line { fill: none; stroke: #000; shape-rendering: crispEdges; } sup, sub { line-height: 0; } q:before { content: "“"; } q:after { content: "”"; } blockquote q { line-height: 1.5em; display: inline; } blockquote q:before, blockquote q:after { content: ""; } h3, h4, p, ul { padding-left: 1.2rem; } .banner { padding: 0; } #toc { margin-top: 0; } @media only screen and (max-device-width: 1023px) { .ocks-org body { font-size: 72%; padding: 0.5rem; } body > p, div > p { width: 90vw !important; } li { width: 82vw; } h3, h4, p, ul { padding-left: .7rem; width: 90vw; } h1 { font-size: 2rem; } pre { padding-left: 0.5rem; } .banner, h1, img { max-width: calc(100vw - 2em); min-width: calc(100vw - 2em); } } /*@import url(web/style.css);*/ @font-face {font-family: "Menlo web"; src: url("OnlineWebFonts_COM_cb7eb796ae7de7195a34c485cacebad1\\@font-face\\9f94dc20bb2a09c15241d3a880b7ad01.woff2") format("woff2"), /* chrome、firefox */ url("OnlineWebFonts_COM_cb7eb796ae7de7195a34c485cacebad1\\@font-face\\9f94dc20bb2a09c15241d3a880b7ad01.woff") format("woff"); font-weight: normal; } @font-face {font-family: "Menlo web"; src: url("OnlineWebFonts_COM_d6ba633f6ea4cafe1a39ab736fe55e88\\Menlo Bold\\@font-face\\a6ffc5d72a96b65159e710ea6d258ba4.woff2") format("woff2"), /* chrome、firefox */ url("OnlineWebFonts_COM_d6ba633f6ea4cafe1a39ab736fe55e88\\Menlo Bold\\@font-face\\a6ffc5d72a96b65159e710ea6d258ba4.woff") format("woff"); font-weight: bold; } .join, .link, .node rect { fill: none; stroke: #636363; stroke-width: 1.5px; } .link { stroke: #969696; } .node rect { fill: white; } .link path, .node rect, .node text, .join { -webkit-transition: stroke-opacity 500ms linear, fill-opacity 500ms linear; -moz-transition: stroke-opacity 500ms linear, fill-opacity 500ms linear; -ms-transition: stroke-opacity 500ms linear, fill-opacity 500ms linear; -o-transition: stroke-opacity 500ms linear, fill-opacity 500ms linear; transition: stroke-opacity 500ms linear, fill-opacity 500ms linear; } .node .element rect { fill: #bdbdbd; stroke: none; } .node .null rect { fill: none; stroke: none; } .node .null text { fill: #636363; } .node .selection rect { stroke: #e6550d; } .node .data rect { stroke: #3182bd; } .node .datum rect { fill: #d9d9d9; stroke: none; } .node .code text { font-family: monospace; color: hsl(0deg 0% 74%) } .node .key rect { fill: #a1d99b; stroke: none; } .link .to-key, .join { stroke: #a1d99b; } .join { stroke-dasharray: 2,2; } .link .to-null { stroke-dasharray: .5,3.5; stroke-linecap: round; } .link .from-data { stroke: #3182bd; } .play circle { fill: #fff; stroke: #000; stroke-width: 3px; } .play:hover path { fill: #f00; } .play.mousedown circle { fill: #f00; } .play.mousedown path { fill: #fff; } .play rect { fill: none; pointer-events: all; cursor: pointer; } code span { -webkit-transition: background 250ms linear; -moz-transition: background 250ms linear; -ms-transition: background 250ms linear; -o-transition: background 250ms linear; transition: background 250ms linear; } pre.prettyprint, code.prettyprint { background-color: #222; border-radius: 8px; font-size: 15px; } pre.prettyprint { width: 90%; margin: 0.5em; padding: 1em; white-space: pre-wrap; } #return-to-top { position: fixed; bottom: 20px; right: 20px; background: rgb(0, 0, 0); background: rgba(0, 0, 0, 0.2); width: 50px; height: 50px; display: block; text-decoration: none; -webkit-border-radius: 35px; -moz-border-radius: 35px; border-radius: 35px; display: none; -webkit-transition: all 0.3s linear; -moz-transition: all 0.3s ease; -ms-transition: all 0.3s ease; -o-transition: all 0.3s ease; transition: all 0.3s ease; } #return-to-top i { color: #fff; margin: 0; position: relative; left: 16px; top: 13px; font-size: 19px; -webkit-transition: all 0.3s ease; -moz-transition: all 0.3s ease; -ms-transition: all 0.3s ease; -o-transition: all 0.3s ease; transition: all 0.3s ease; } #return-to-top:hover { background: rgba(0, 0, 0, 0.35); } #return-to-top:hover i { color: #f0f0f0; } @media print { .pagebreak { page-break-before: always; } div { page-break-inside: avoid; } pre { page-break-inside: avoid; } } .modebar{ display: none !important; } ================================================ FILE: web/style_dark1.css ================================================ /* Copyright 2013 Michael Bostock. All rights reserved. Do not copy. */ @import url(https://fonts.googleapis.com/css?family=PT+Serif|PT+Serif:b|PT+Serif:i|PT+Sans|PT+Sans:b); .ocks-org body { background: hsl(206deg 47% 9%); color: hsl(0deg 0% 72%); font-family: "PT Serif", serif; margin: 1em auto 4em auto; position: relative; width: 960px; padding: 1rem; } .ocks-org header, .ocks-org footer, .ocks-org aside, .ocks-org h1, .ocks-org h2, .ocks-org h3, .ocks-org h4 { font-family: "PT Sans", sans-serif; } .ocks-org h1, .ocks-org h2, .ocks-org h3, .ocks-org h4 { color: hsl(0deg 1% 77%); } .ocks-org header, .ocks-org footer { color: #636363; } h1 { font-size: 67px; font-weight: 300; letter-spacing: -2px; margin: 0.3em 0 0.1em 0; } h2 { margin-top: 2em; } h1, h2 { text-rendering: optimizeLegibility; } h2 a[name], h2 a[id] { color: hsl(0deg 0% 75% / 49%); padding-right: 0.3em; } header, footer { font-size: small; } .ocks-org header aside, .ocks-org footer aside { float: left; margin-right: 0.5em; } .ocks-org header aside:after, .ocks-org footer aside:after { padding-left: 0.5em; content: "/"; } footer { margin-top: 6em; } h1 ~ aside { font-size: small; right: 0; position: absolute; width: 180px; } .attribution { font-size: small; margin-bottom: 2em; } body > p, li > p, div > p { line-height: 1.5em; } body > p, div > p { width: 720px; } body > blockquote { width: 640px; } blockquote q { display: block; font-style: oblique; } ul { padding: 0; } li { width: 690px; margin-left: 30px; } a { color: steelblue; } a:not(:hover) { text-decoration: none; } pre, code, textarea { font-family: "Menlo", "Menlo Web", monospace; } code { line-height: 1em; color: hsl(0deg 0% 96% / 65%); } textarea { font-size: 100%; } pre { border-left: solid 2px hsl(206deg 34% 14%); padding-left: 18px; margin: 1em 0 1em 0; background: hsl(206deg 34% 14%); border-radius: 6px; padding-top: 16px; padding-bottom: 16px; } .html .value, .javascript .string, .javascript .regexp { color: #756bb1; } .html .tag, .css .tag, .javascript .keyword { color: #3182bd; } .comment { color: #636363; } .html .doctype, .javascript .number { color: #31a354; } .html .attribute, .css .attribute, .javascript .class, .javascript .special { color: #e6550d; } svg { font: 10px sans-serif; } .axis path, .axis line { fill: none; stroke: #000; shape-rendering: crispEdges; } sup, sub { line-height: 0; } q:before { content: "“"; } q:after { content: "”"; } blockquote q { line-height: 1.5em; display: inline; } blockquote q:before, blockquote q:after { content: ""; } h3, h4, p, ul { padding-left: 1.2rem; } .banner { padding: 0; } #toc { margin-top: 0; } @media only screen and (max-device-width: 1023px) { .ocks-org body { font-size: 72%; padding: 0.5rem; } body > p, div > p { width: 90vw !important; } li { width: 82vw; } h3, h4, p, ul { padding-left: .7rem; width: 90vw; } h1 { font-size: 2rem; } pre { padding-left: 0.5rem; } .banner, h1, img { max-width: calc(100vw - 2em); min-width: calc(100vw - 2em); } } /*@import url(web/style.css);*/ @font-face {font-family: "Menlo web"; src: url("OnlineWebFonts_COM_cb7eb796ae7de7195a34c485cacebad1\\@font-face\\9f94dc20bb2a09c15241d3a880b7ad01.woff2") format("woff2"), /* chrome、firefox */ url("OnlineWebFonts_COM_cb7eb796ae7de7195a34c485cacebad1\\@font-face\\9f94dc20bb2a09c15241d3a880b7ad01.woff") format("woff"); font-weight: normal; } @font-face {font-family: "Menlo web"; src: url("OnlineWebFonts_COM_d6ba633f6ea4cafe1a39ab736fe55e88\\Menlo Bold\\@font-face\\a6ffc5d72a96b65159e710ea6d258ba4.woff2") format("woff2"), /* chrome、firefox */ url("OnlineWebFonts_COM_d6ba633f6ea4cafe1a39ab736fe55e88\\Menlo Bold\\@font-face\\a6ffc5d72a96b65159e710ea6d258ba4.woff") format("woff"); font-weight: bold; } .join, .link, .node rect { fill: none; stroke: #636363; stroke-width: 1.5px; } .link { stroke: #969696; } .node rect { fill: white; } .link path, .node rect, .node text, .join { -webkit-transition: stroke-opacity 500ms linear, fill-opacity 500ms linear; -moz-transition: stroke-opacity 500ms linear, fill-opacity 500ms linear; -ms-transition: stroke-opacity 500ms linear, fill-opacity 500ms linear; -o-transition: stroke-opacity 500ms linear, fill-opacity 500ms linear; transition: stroke-opacity 500ms linear, fill-opacity 500ms linear; } .node .element rect { fill: #bdbdbd; stroke: none; } .node .null rect { fill: none; stroke: none; } .node .null text { fill: #636363; } .node .selection rect { stroke: #e6550d; } .node .data rect { stroke: #3182bd; } .node .datum rect { fill: #d9d9d9; stroke: none; } .node .code text { font-family: monospace; color: hsl(0deg 0% 74%) } .node .key rect { fill: #a1d99b; stroke: none; } .link .to-key, .join { stroke: #a1d99b; } .join { stroke-dasharray: 2,2; } .link .to-null { stroke-dasharray: .5,3.5; stroke-linecap: round; } .link .from-data { stroke: #3182bd; } .play circle { fill: #fff; stroke: #000; stroke-width: 3px; } .play:hover path { fill: #f00; } .play.mousedown circle { fill: #f00; } .play.mousedown path { fill: #fff; } .play rect { fill: none; pointer-events: all; cursor: pointer; } code span { -webkit-transition: background 250ms linear; -moz-transition: background 250ms linear; -ms-transition: background 250ms linear; -o-transition: background 250ms linear; transition: background 250ms linear; } pre.prettyprint, code.prettyprint { background-color: #222; border-radius: 8px; font-size: 15px; } pre.prettyprint { width: 90%; margin: 0.5em; padding: 1em; white-space: pre-wrap; } #return-to-top { position: fixed; bottom: 20px; right: 20px; background: rgb(0, 0, 0); background: rgba(0, 0, 0, 0.2); width: 50px; height: 50px; display: block; text-decoration: none; -webkit-border-radius: 35px; -moz-border-radius: 35px; border-radius: 35px; display: none; -webkit-transition: all 0.3s linear; -moz-transition: all 0.3s ease; -ms-transition: all 0.3s ease; -o-transition: all 0.3s ease; transition: all 0.3s ease; } #return-to-top i { color: #fff; margin: 0; position: relative; left: 16px; top: 13px; font-size: 19px; -webkit-transition: all 0.3s ease; -moz-transition: all 0.3s ease; -ms-transition: all 0.3s ease; -o-transition: all 0.3s ease; transition: all 0.3s ease; } #return-to-top:hover { background: rgba(0, 0, 0, 0.35); } #return-to-top:hover i { color: #f0f0f0; } @media print { .pagebreak { page-break-before: always; } div { page-break-inside: avoid; } pre { page-break-inside: avoid; } } .modebar{ display: none !important; } ================================================ FILE: web/style_dark2.css ================================================ /* Copyright 2013 Michael Bostock. All rights reserved. Do not copy. */ @import url(https://fonts.googleapis.com/css?family=PT+Serif|PT+Serif:b|PT+Serif:i|PT+Sans|PT+Sans:b); .ocks-org body { background: hsl(206deg 47% 9%); color: hsl(0deg 0% 72%); font-family: "PT Serif", serif; margin: 1em auto 4em auto; position: relative; width: 960px; padding: 1rem; } .ocks-org header, .ocks-org footer, .ocks-org aside, .ocks-org h1, .ocks-org h2, .ocks-org h3, .ocks-org h4 { font-family: "PT Sans", sans-serif; } .ocks-org h1, .ocks-org h2, .ocks-org h3, .ocks-org h4 { color: hsl(0deg 1% 71%); } .ocks-org header, .ocks-org footer { color: #999999; } h1 { font-size: 64px; font-weight: 300; letter-spacing: -2px; margin: 0.3em 0 0.1em 0; } h2 { margin-top: 2em; } h1, h2 { text-rendering: optimizeLegibility; } h2 a[name], h2 a[id] { color: #5f5c5c; padding-right: 0.3em; } header, footer { font-size: small; } .ocks-org header aside, .ocks-org footer aside { float: left; margin-right: 0.5em; } .ocks-org header aside:after, .ocks-org footer aside:after { padding-left: 0.5em; content: "/"; } footer { margin-top: 6em; } h1 ~ aside { font-size: small; right: 0; position: absolute; width: 180px; } .attribution { font-size: small; margin-bottom: 2em; } body > p, li > p, div > p { line-height: 1.5em; } body > p, div > p { width: 720px; } body > blockquote { width: 640px; } blockquote q { display: block; font-style: oblique; } ul { padding: 0; } li { width: 690px; margin-left: 30px; } a { color: hsl(187deg 100% 33%); } a:not(:hover) { text-decoration: none; } pre, code, textarea { font-family: "Menlo", "Menlo Web", monospace; } code { line-height: 1em; color: hsl(0deg 0% 74%); } textarea { font-size: 100%; } pre { border-left: solid 2px #424242; padding-left: 18px; margin: 2em 0 2em 0; } .html .value, .javascript .string, .javascript .regexp { color: #756bb1; } .html .tag, .css .tag, .javascript .keyword { color: #3182bd; } .comment { color: #636363; } .html .doctype, .javascript .number { color: #31a354; } .html .attribute, .css .attribute, .javascript .class, .javascript .special { color: #e6550d; } svg { font: 10px sans-serif; } .axis path, .axis line { fill: none; stroke: #000; shape-rendering: crispEdges; } sup, sub { line-height: 0; } q:before { content: "“"; } q:after { content: "”"; } blockquote q { line-height: 1.5em; display: inline; } blockquote q:before, blockquote q:after { content: ""; } h3, h4, p, ul { padding-left: 1.2rem; } .banner { padding: 0; } #toc { margin-top: 0; } @media only screen and (max-device-width: 1023px) { .ocks-org body { font-size: 72%; padding: 0.5rem; } body > p, div > p { width: 90vw !important; } li { width: 82vw; } h3, h4, p, ul { padding-left: .7rem; width: 90vw; } h1 { font-size: 2rem; } pre { padding-left: 0.5rem; } .banner, h1, img { max-width: calc(100vw - 2em); min-width: calc(100vw - 2em); } } /*@import url(web/style.css);*/ @font-face {font-family: "Menlo web"; src: url("OnlineWebFonts_COM_cb7eb796ae7de7195a34c485cacebad1\\@font-face\\9f94dc20bb2a09c15241d3a880b7ad01.woff2") format("woff2"), /* chrome、firefox */ url("OnlineWebFonts_COM_cb7eb796ae7de7195a34c485cacebad1\\@font-face\\9f94dc20bb2a09c15241d3a880b7ad01.woff") format("woff"); font-weight: normal; } @font-face {font-family: "Menlo web"; src: url("OnlineWebFonts_COM_d6ba633f6ea4cafe1a39ab736fe55e88\\Menlo Bold\\@font-face\\a6ffc5d72a96b65159e710ea6d258ba4.woff2") format("woff2"), /* chrome、firefox */ url("OnlineWebFonts_COM_d6ba633f6ea4cafe1a39ab736fe55e88\\Menlo Bold\\@font-face\\a6ffc5d72a96b65159e710ea6d258ba4.woff") format("woff"); font-weight: bold; } .join, .link, .node rect { fill: none; stroke: #636363; stroke-width: 1.5px; } .link { stroke: #969696; } .node rect { fill: white; } .link path, .node rect, .node text, .join { -webkit-transition: stroke-opacity 500ms linear, fill-opacity 500ms linear; -moz-transition: stroke-opacity 500ms linear, fill-opacity 500ms linear; -ms-transition: stroke-opacity 500ms linear, fill-opacity 500ms linear; -o-transition: stroke-opacity 500ms linear, fill-opacity 500ms linear; transition: stroke-opacity 500ms linear, fill-opacity 500ms linear; } .node .element rect { fill: #bdbdbd; stroke: none; } .node .null rect { fill: none; stroke: none; } .node .null text { fill: #636363; } .node .selection rect { stroke: #e6550d; } .node .data rect { stroke: #3182bd; } .node .datum rect { fill: #d9d9d9; stroke: none; } .node .code text { font-family: monospace; color: hsl(0deg 0% 74%) } .node .key rect { fill: #a1d99b; stroke: none; } .link .to-key, .join { stroke: #a1d99b; } .join { stroke-dasharray: 2,2; } .link .to-null { stroke-dasharray: .5,3.5; stroke-linecap: round; } .link .from-data { stroke: #3182bd; } .play circle { fill: #fff; stroke: #000; stroke-width: 3px; } .play:hover path { fill: #f00; } .play.mousedown circle { fill: #f00; } .play.mousedown path { fill: #fff; } .play rect { fill: none; pointer-events: all; cursor: pointer; } code span { -webkit-transition: background 250ms linear; -moz-transition: background 250ms linear; -ms-transition: background 250ms linear; -o-transition: background 250ms linear; transition: background 250ms linear; } pre.prettyprint, code.prettyprint { background-color: #222; border-radius: 8px; font-size: 15px; } pre.prettyprint { width: 90%; margin: 0.5em; padding: 1em; white-space: pre-wrap; } #return-to-top { position: fixed; bottom: 20px; right: 20px; background: rgb(0, 0, 0); background: rgba(0, 0, 0, 0.2); width: 50px; height: 50px; display: block; text-decoration: none; -webkit-border-radius: 35px; -moz-border-radius: 35px; border-radius: 35px; display: none; -webkit-transition: all 0.3s linear; -moz-transition: all 0.3s ease; -ms-transition: all 0.3s ease; -o-transition: all 0.3s ease; transition: all 0.3s ease; } #return-to-top i { color: #fff; margin: 0; position: relative; left: 16px; top: 13px; font-size: 19px; -webkit-transition: all 0.3s ease; -moz-transition: all 0.3s ease; -ms-transition: all 0.3s ease; -o-transition: all 0.3s ease; transition: all 0.3s ease; } #return-to-top:hover { background: rgba(0, 0, 0, 0.35); } #return-to-top:hover i { color: #f0f0f0; } @media print { .pagebreak { page-break-before: always; } div { page-break-inside: avoid; } pre { page-break-inside: avoid; } } .modebar{ display: none !important; } ================================================ FILE: web/style_dark3.css ================================================ /* Copyright 2013 Michael Bostock. All rights reserved. Do not copy. */ @import url(https://fonts.googleapis.com/css?family=PT+Serif|PT+Serif:b|PT+Serif:i|PT+Sans|PT+Sans:b); .ocks-org body { background: hsl(206deg 47% 9%); color: hsl(249deg 11% 76%); font-family: "PT Serif", serif; margin: 1em auto 4em auto; position: relative; width: 960px; padding: 1rem; } .ocks-org header, .ocks-org footer, .ocks-org aside, .ocks-org h1, .ocks-org h2, .ocks-org h3, .ocks-org h4 { font-family: "PT Sans", sans-serif; } .ocks-org h1, .ocks-org h2, .ocks-org h3, .ocks-org h4 { color: hsl(249deg 11% 75%); } .ocks-org header, .ocks-org footer { color: #999999; } h1 { font-size: 64px; font-weight: 300; letter-spacing: -2px; margin: 0.3em 0 0.1em 0; } h2 { margin-top: 2em; } h1, h2 { text-rendering: optimizeLegibility; } h2 a[name], h2 a[id] { color: hsl(249deg 3% 31%); padding-right: 0.3em; } header, footer { font-size: small; } .ocks-org header aside, .ocks-org footer aside { float: left; margin-right: 0.5em; } .ocks-org header aside:after, .ocks-org footer aside:after { padding-left: 0.5em; content: "/"; } footer { margin-top: 6em; } h1 ~ aside { font-size: small; right: 0; position: absolute; width: 180px; } .attribution { font-size: small; margin-bottom: 2em; } body > p, li > p, div > p { line-height: 1.5em; } body > p, div > p { width: 720px; } body > blockquote { width: 640px; } blockquote q { display: block; font-style: oblique; } ul { padding: 0; } li { width: 690px; margin-left: 30px; } a { color: hsl(187deg 100% 33%); } a:not(:hover) { text-decoration: none; } pre, code, textarea { font-family: "Menlo", "Menlo Web", "Menlo Web ss", monospace; } code { line-height: 1em; color: hsl(249deg 11% 78%); } textarea { font-size: 100%; } pre { border-left: solid 2px hsl(0deg 0% 26%); padding-left: 18px; margin: 2em 0 2em 0; } .html .value, .javascript .string, .javascript .regexp { color: #756bb1; } .html .tag, .css .tag, .javascript .keyword { color: #3182bd; } .comment { color: #636363; } .html .doctype, .javascript .number { color: #31a354; } .html .attribute, .css .attribute, .javascript .class, .javascript .special { color: #e6550d; } svg { font: 10px sans-serif; } .axis path, .axis line { fill: none; stroke: #000; shape-rendering: crispEdges; } sup, sub { line-height: 0; } q:before { content: "“"; } q:after { content: "”"; } blockquote q { line-height: 1.5em; display: inline; } blockquote q:before, blockquote q:after { content: ""; } h3, h4, p, ul { padding-left: 1.2rem; } .banner { padding: 0; } #toc { margin-top: 0; } @media only screen and (max-device-width: 1023px) { .ocks-org body { font-size: 72%; padding: 0.5rem; } body > p, div > p { width: 90vw !important; } li { width: 82vw; } h3, h4, p, ul { padding-left: .7rem; width: 90vw; } h1 { font-size: 2rem; } pre { padding-left: 0.5rem; } .banner, h1, img { max-width: calc(100vw - 2em); min-width: calc(100vw - 2em); } } /*@import url(web/style.css);*/ @font-face {font-family: "Menlo web"; src: url("OnlineWebFonts_COM_cb7eb796ae7de7195a34c485cacebad1\\@font-face\\9f94dc20bb2a09c15241d3a880b7ad01.woff2") format("woff2"), /* chrome、firefox */ url("OnlineWebFonts_COM_cb7eb796ae7de7195a34c485cacebad1\\@font-face\\9f94dc20bb2a09c15241d3a880b7ad01.woff") format("woff"); font-weight: normal; } @font-face {font-family: "Menlo web"; src: url("OnlineWebFonts_COM_d6ba633f6ea4cafe1a39ab736fe55e88\\Menlo Bold\\@font-face\\a6ffc5d72a96b65159e710ea6d258ba4.woff2") format("woff2"), /* chrome、firefox */ url("OnlineWebFonts_COM_d6ba633f6ea4cafe1a39ab736fe55e88\\Menlo Bold\\@font-face\\a6ffc5d72a96b65159e710ea6d258ba4.woff") format("woff"); font-weight: bold; } @font-face {font-family: "Menlo web ss"; src: url("OnlineWebFonts_COM_cb7eb796ae7de7195a34c485cacebad1\\@font-face\\9f94dc20bb2a09c15241d3a880b7ad01-ss2.woff") format("woff"); font-weight: normal; } .join, .link, .node rect { fill: none; stroke: #636363; stroke-width: 1.5px; } .link { stroke: #969696; } .node rect { fill: white; } .link path, .node rect, .node text, .join { -webkit-transition: stroke-opacity 500ms linear, fill-opacity 500ms linear; -moz-transition: stroke-opacity 500ms linear, fill-opacity 500ms linear; -ms-transition: stroke-opacity 500ms linear, fill-opacity 500ms linear; -o-transition: stroke-opacity 500ms linear, fill-opacity 500ms linear; transition: stroke-opacity 500ms linear, fill-opacity 500ms linear; } .node .element rect { fill: #bdbdbd; stroke: none; } .node .null rect { fill: none; stroke: none; } .node .null text { fill: #636363; } .node .selection rect { stroke: #e6550d; } .node .data rect { stroke: #3182bd; } .node .datum rect { fill: #d9d9d9; stroke: none; } .node .code text { font-family: monospace; color: hsl(0deg 0% 74%) } .node .key rect { fill: #a1d99b; stroke: none; } .link .to-key, .join { stroke: #a1d99b; } .join { stroke-dasharray: 2,2; } .link .to-null { stroke-dasharray: .5,3.5; stroke-linecap: round; } .link .from-data { stroke: #3182bd; } .play circle { fill: #fff; stroke: #000; stroke-width: 3px; } .play:hover path { fill: #f00; } .play.mousedown circle { fill: #f00; } .play.mousedown path { fill: #fff; } .play rect { fill: none; pointer-events: all; cursor: pointer; } code span { -webkit-transition: background 250ms linear; -moz-transition: background 250ms linear; -ms-transition: background 250ms linear; -o-transition: background 250ms linear; transition: background 250ms linear; } pre.prettyprint, code.prettyprint { background-color: #222; border-radius: 8px; font-size: 15px; } pre.prettyprint { width: 90%; margin: 0.5em; padding: 1em; white-space: pre-wrap; } #return-to-top { position: fixed; bottom: 20px; right: 20px; background: rgb(0, 0, 0); background: rgba(0, 0, 0, 0.2); width: 50px; height: 50px; display: block; text-decoration: none; -webkit-border-radius: 35px; -moz-border-radius: 35px; border-radius: 35px; display: none; -webkit-transition: all 0.3s linear; -moz-transition: all 0.3s ease; -ms-transition: all 0.3s ease; -o-transition: all 0.3s ease; transition: all 0.3s ease; } #return-to-top i { color: #fff; margin: 0; position: relative; left: 16px; top: 13px; font-size: 19px; -webkit-transition: all 0.3s ease; -moz-transition: all 0.3s ease; -ms-transition: all 0.3s ease; -o-transition: all 0.3s ease; transition: all 0.3s ease; } #return-to-top:hover { background: rgba(0, 0, 0, 0.35); } #return-to-top:hover i { color: #f0f0f0; } @media print { .pagebreak { page-break-before: always; } div { page-break-inside: avoid; } pre { page-break-inside: avoid; } } .modebar{ display: none !important; } ================================================ FILE: web/template.html ================================================ Comprehensive Python Cheatsheet
    ================================================ FILE: web/update_plots.py ================================================ #!/usr/bin/env python3 # # Usage: ./update_plots.py # Updates plots from the Plotly section so they show the latest data. from pathlib import Path import datetime import pandas as pd from plotly.express import line import plotly.graph_objects as go import re def main(): print('Updating covid deaths...') update_covid_deaths() print('Updating covid cases...') update_confirmed_cases() def update_covid_deaths(): covid = pd.read_csv('https://covid.ourworldindata.org/data/owid-covid-data.csv', usecols=['iso_code', 'date', 'total_deaths', 'population']) continents = pd.read_csv('https://gist.githubusercontent.com/stevewithington/20a69c0b6d2ff' '846ea5d35e5fc47f26c/raw/country-and-continent-codes-list-csv.csv', usecols=['Three_Letter_Country_Code', 'Continent_Name']) df = pd.merge(covid, continents, left_on='iso_code', right_on='Three_Letter_Country_Code') df = df.groupby(['Continent_Name', 'date']).sum().reset_index() df['Total Deaths per Million'] = round(df.total_deaths * 1e6 / df.population) today = str(datetime.date.today()) df = df[('2020-02-22' < df.date) & (df.date < today)] df = df.rename({'date': 'Date', 'Continent_Name': 'Continent'}, axis='columns') gb = df.groupby('Continent') df['Max Total Deaths'] = gb[['Total Deaths per Million']].transform('max') df = df.sort_values(['Max Total Deaths', 'Date'], ascending=[False, True]) f = line(df, x='Date', y='Total Deaths per Million', color='Continent') f.update_layout(margin=dict(t=24, b=0), paper_bgcolor='rgba(0, 0, 0, 0)') update_file('covid_deaths.js', f) f.layout.paper_bgcolor = 'rgb(255, 255, 255)' write_to_png_file('covid_deaths.png', f, width=960, height=340) def update_confirmed_cases(): def main(): df = wrangle_data(*scrape_data()) f = get_figure(df) update_file('covid_cases.js', f) f.layout.paper_bgcolor = 'rgb(255, 255, 255)' write_to_png_file('covid_cases.png', f, width=960, height=315) def scrape_data(): def scrape_covid(): url = 'https://covid.ourworldindata.org/data/owid-covid-data.csv' df = pd.read_csv(url, usecols=['location', 'date', 'total_cases']) return df[df.location == 'World'].set_index('date').total_cases def scrape_yahoo(slug): url = f'https://query1.finance.yahoo.com/v7/finance/download/{slug}' + \ '?period1=1579651200&period2=9999999999&interval=1d&events=history' df = pd.read_csv(url, usecols=['Date', 'Close']) return df.set_index('Date').Close out = [scrape_covid(), scrape_yahoo('BTC-USD'), scrape_yahoo('GC=F'), scrape_yahoo('^DJI')] return map(pd.Series.rename, out, ['Total Cases', 'Bitcoin', 'Gold', 'Dow Jones']) def wrangle_data(covid, bitcoin, gold, dow): df = pd.concat([dow, gold, bitcoin], axis=1) # Joins columns on dates. df = df.sort_index().interpolate() # Sorts by date and interpolates NaN-s. yesterday = str(datetime.date.today() - datetime.timedelta(1)) df = df.loc['2020-02-23':yesterday] # Discards rows before '2020-02-23'. df = round((df / df.iloc[0]) * 100, 2) # Calculates percentages relative to day 1 df = df.join(covid) # Adds column with covid cases. return df.sort_values(df.index[-1], axis=1) # Sorts columns by last day's value. def get_figure(df): figure = go.Figure() for col_name in reversed(df.columns): yaxis = 'y1' if col_name == 'Total Cases' else 'y2' colors = {'Total Cases': '#EF553B', 'Bitcoin': '#636efa', 'Gold': '#FFA15A', 'Dow Jones': '#00cc96'} trace = go.Scatter(x=df.index, y=df[col_name], name=col_name, yaxis=yaxis, line=dict(color=colors[col_name])) figure.add_trace(trace) figure.update_layout( yaxis1=dict(title='Total Cases', rangemode='tozero'), yaxis2=dict(title='%', rangemode='tozero', overlaying='y', side='right'), legend=dict(x=1.1), margin=dict(t=24, b=0), paper_bgcolor='rgba(0, 0, 0, 0)' ) return figure main() ### ## UTIL # def update_file(filename, figure): lines = read_file(filename) f_json = figure.to_json(pretty=True).replace('\n', '\n ') out = lines[:6] + [f' {f_json}\n', ' )\n', '};\n'] write_to_file(filename, out) def read_file(filename): p = Path(__file__).resolve().parent / filename with open(p, encoding='utf-8') as file: return file.readlines() def write_to_file(filename, lines): p = Path(__file__).resolve().parent / filename with open(p, 'w', encoding='utf-8') as file: file.writelines(lines) def write_to_png_file(filename, figure, width, height): p = Path(__file__).resolve().parent / filename figure.write_image(str(p), width=width, height=height) if __name__ == '__main__': main()