main > main: 3rd party imports

This commit is contained in:
RD 2023-02-27 13:27:55 +01:00
parent ba54939a3b
commit cf880ccffc
5 changed files with 206 additions and 29 deletions

32
src/thirdparty/db.py vendored Normal file
View File

@ -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',
];

View File

@ -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',
];

139
src/thirdparty/plots.py vendored Normal file
View File

@ -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 <https://plotly.com/python/builtin-colorscales>
'''
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',
];

View File

@ -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',
];

View File

@ -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',
];