diff --git a/src/thirdparty/db.py b/src/thirdparty/db.py new file mode 100644 index 0000000..f1547e8 --- /dev/null +++ b/src/thirdparty/db.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# IMPORTS +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +import sqlite3; +from sqlite3 import Binary; +from sqlite3 import Connection; +from sqlite3 import connect; +from sqlite3 import Cursor; +from sqlite3 import PARSE_DECLTYPES; +from sqlite3 import register_adapter; +from sqlite3 import register_converter; +import pandas as pd; + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# EXPORTS +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +__all__ = [ + 'Binary', + 'Connection', + 'Cursor', + 'PARSE_DECLTYPES', + 'connect', + 'pd', + 'register_adapter', + 'register_converter', + 'sqlite3', +]; diff --git a/src/thirdparty/maths.py b/src/thirdparty/maths.py index b7fbf06..e47ba8c 100644 --- a/src/thirdparty/maths.py +++ b/src/thirdparty/maths.py @@ -9,6 +9,7 @@ from fractions import Fraction; import math; import numpy as np; import random; +from collections import deque as Stack; # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # EXPORTS @@ -19,4 +20,5 @@ __all__ = [ 'math', 'np', 'random', + 'Stack', ]; diff --git a/src/thirdparty/plots.py b/src/thirdparty/plots.py new file mode 100644 index 0000000..746e417 --- /dev/null +++ b/src/thirdparty/plots.py @@ -0,0 +1,139 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# IMPORTS +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +from enum import Enum; +from matplotlib import pyplot as mplot; +from matplotlib import colors as mcolours; +from matplotlib import ticker as mticker; +from matplotlib.figure import Figure; +from matplotlib.axes import Axes; +from matplotlib.patches import Polygon; +from matplotlib.patches import FancyArrowPatch; +import plotly; +import plotly.express as px; +import plotly.graph_objects as pgo; + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# MODIFICATIONS +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +class PLOTLY_COLOUR_SCHEME(Enum): + ''' + Colour schemes for Plotly + ''' + AGGRNYL = 'aggrnyl'; + AGSUNSET = 'agsunset'; + ALGAE = 'algae'; + AMP = 'amp'; + ARMYROSE = 'armyrose'; + BALANCE = 'balance'; + BLACKBODY = 'blackbody'; + BLUERED = 'bluered'; + BLUES = 'blues'; + BLUGRN = 'blugrn'; + BLUYL = 'bluyl'; + BRBG = 'brbg'; + BRWNYL = 'brwnyl'; + BUGN = 'bugn'; + BUPU = 'bupu'; + BURG = 'burg'; + BURGYL = 'burgyl'; + CIVIDIS = 'cividis'; + CURL = 'curl'; + DARKMINT = 'darkmint'; + DEEP = 'deep'; + DELTA = 'delta'; + DENSE = 'dense'; + EARTH = 'earth'; + EDGE = 'edge'; + ELECTRIC = 'electric'; + EMRLD = 'emrld'; + FALL = 'fall'; + GEYSER = 'geyser'; + GNBU = 'gnbu'; + GRAY = 'gray'; + GREENS = 'greens'; + GREYS = 'greys'; + HALINE = 'haline'; + HOT = 'hot'; + HSV = 'hsv'; + ICE = 'ice'; + ICEFIRE = 'icefire'; + INFERNO = 'inferno'; + JET = 'jet'; + MAGENTA = 'magenta'; + MAGMA = 'magma'; + MATTER = 'matter'; + MINT = 'mint'; + MRYBM = 'mrybm'; + MYGBM = 'mygbm'; + ORANGES = 'oranges'; + ORRD = 'orrd'; + ORYEL = 'oryel'; + OXY = 'oxy'; + PEACH = 'peach'; + PHASE = 'phase'; + PICNIC = 'picnic'; + PINKYL = 'pinkyl'; + PIYG = 'piyg'; + PLASMA = 'plasma'; + PLOTLY3 = 'plotly3'; + PORTLAND = 'portland'; + PRGN = 'prgn'; + PUBU = 'pubu'; + PUBUGN = 'pubugn'; + PUOR = 'puor'; + PURD = 'purd'; + PURP = 'purp'; + PURPLES = 'purples'; + PURPOR = 'purpor'; + RAINBOW = 'rainbow'; + RDBU = 'rdbu'; + RDGY = 'rdgy'; + RDPU = 'rdpu'; + RDYLBU = 'rdylbu'; + RDYLGN = 'rdylgn'; + REDOR = 'redor'; + REDS = 'reds'; + SOLAR = 'solar'; + SPECTRAL = 'spectral'; + SPEED = 'speed'; + SUNSET = 'sunset'; + SUNSETDARK = 'sunsetdark'; + TEAL = 'teal'; + TEALGRN = 'tealgrn'; + TEALROSE = 'tealrose'; + TEMPO = 'tempo'; + TEMPS = 'temps'; + THERMAL = 'thermal'; + TROPIC = 'tropic'; + TURBID = 'turbid'; + TURBO = 'turbo'; + TWILIGHT = 'twilight'; + VIRIDIS = 'viridis'; + YLGN = 'ylgn'; + YLGNBU = 'ylgnbu'; + YLORBR = 'ylorbr'; + YLORRD = 'ylorrd'; + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# EXPORTS +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +__all__ = [ + 'Axes', + 'FancyArrowPatch', + 'Figure', + 'Polygon', + 'mcolours', + 'mplot', + 'mticker', + 'pgo', + 'PLOTLY_COLOUR_SCHEME', + 'plotly', + 'px', +]; diff --git a/src/thirdparty/render.py b/src/thirdparty/render.py index e41c841..f2f3b64 100644 --- a/src/thirdparty/render.py +++ b/src/thirdparty/render.py @@ -11,7 +11,8 @@ from IPython.display import display_png; from IPython.display import display_markdown; from IPython.display import display; # from array_to_latex import to_ltx as array_to_latex; # <- has issues -from qiskit.visualization import array_to_latex; +# from qiskit.visualization import array_to_latex; +from tabulate import tabulate; # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # EXPORTS @@ -23,5 +24,6 @@ __all__ = [ 'display_latex', 'display_png', 'display_markdown', - 'array_to_latex', + # 'array_to_latex', + 'tabulate', ]; diff --git a/src/thirdparty/types.py b/src/thirdparty/types.py index cfaf601..5118d0c 100644 --- a/src/thirdparty/types.py +++ b/src/thirdparty/types.py @@ -32,53 +32,55 @@ from typing import Any; from typing import Awaitable; from typing import Callable; from typing import ClassVar; +from typing import Concatenate; from typing import Coroutine; from typing import Generator; from typing import Generic; +from typing import Literal; from typing import Optional; +from typing import ParamSpec; from typing import Type; from typing import TypeVar; -from typing_extensions import Concatenate; -from typing_extensions import ParamSpec; # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # EXPORTS # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __all__ = [ - 'Enum', - 'BytesIO', - 'NDArray', - 'Shape', - 'Bool', - 'UInt', - 'UInt8', - 'UInt32', - 'UInt64', - 'Int', - 'Int32', - 'Int64', - 'Float', - 'Float32', - 'Float64', - 'uint8', - 'int32', - 'int64', - 'float32', - 'float64', - 'complex64', - 'complex128', - 'conint', 'Any', 'Awaitable', + 'Bool', + 'BytesIO', 'Callable', 'ClassVar', + 'complex128', + 'complex64', + 'Concatenate', + 'conint', 'Coroutine', + 'Enum', + 'Float', + 'Float32', + 'float32', + 'Float64', + 'float64', 'Generator', 'Generic', + 'Int', + 'Int32', + 'int32', + 'Int64', + 'int64', + 'Literal', + 'NDArray', 'Optional', + 'ParamSpec', + 'Shape', 'Type', 'TypeVar', - 'Concatenate', - 'ParamSpec', + 'UInt', + 'UInt32', + 'UInt64', + 'UInt8', + 'uint8', ];