mayutils 1.0.89__tar.gz → 1.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mayutils-1.2.0/PKG-INFO +85 -0
- mayutils-1.2.0/pyproject.toml +78 -0
- mayutils-1.2.0/src/mayutils/.DS_Store +0 -0
- mayutils-1.2.0/src/mayutils/__init__.py +37 -0
- mayutils-1.2.0/src/mayutils/core/constants.py +3 -0
- mayutils-1.2.0/src/mayutils/data/.DS_Store +0 -0
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/data/__init__.py +1 -4
- mayutils-1.2.0/src/mayutils/data/queries/.DS_Store +0 -0
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/environment/benchmarking.py +1 -0
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/environment/databases.py +0 -1
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/export/slides.py +4 -5
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/interfaces/google.py +2 -1
- mayutils-1.2.0/src/mayutils/mathematics/__init__.py +15 -0
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/objects/colours.py +78 -1
- mayutils-1.2.0/src/mayutils/objects/datetime.py +508 -0
- mayutils-1.2.0/src/mayutils/scripts/.DS_Store +0 -0
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/scripts/clear_cache.py +1 -1
- mayutils-1.2.0/src/mayutils/visualisation/.DS_Store +0 -0
- mayutils-1.2.0/src/mayutils/visualisation/graphs/__init__.py +3 -0
- mayutils-1.2.0/src/mayutils/visualisation/graphs/combine.py +51 -0
- mayutils-1.2.0/src/mayutils/visualisation/graphs/matplotlib/template.py +0 -0
- mayutils-1.2.0/src/mayutils/visualisation/graphs/plotly/__init__.py +0 -0
- mayutils-1.0.89/src/mayutils/visualisation/graphs.py → mayutils-1.2.0/src/mayutils/visualisation/graphs/plotly/charts.py +57 -1172
- mayutils-1.2.0/src/mayutils/visualisation/graphs/plotly/templates.py +464 -0
- mayutils-1.2.0/src/mayutils/visualisation/graphs/plotly/traces.py +546 -0
- mayutils-1.2.0/src/mayutils/visualisation/graphs/plotly/utilities.py +36 -0
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/visualisation/notebook.py +2 -3
- mayutils-1.0.89/PKG-INFO +0 -81
- mayutils-1.0.89/pyproject.toml +0 -76
- mayutils-1.0.89/src/mayutils/__init__.py +0 -25
- mayutils-1.0.89/src/mayutils/core/constants.py +0 -33
- mayutils-1.0.89/src/mayutils/core/types.py +0 -16
- mayutils-1.0.89/src/mayutils/objects/datetime.py +0 -102
- {mayutils-1.0.89 → mayutils-1.2.0}/LICENSE +0 -0
- {mayutils-1.0.89 → mayutils-1.2.0}/README.md +0 -0
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/core/__init__.py +0 -0
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/data/analysis/__init__.py +0 -0
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/data/cache/.gitkeep +0 -0
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/data/live.py +0 -0
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/data/local.py +0 -0
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/data/queries/.gitkeep +0 -0
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/data/queries/__init__.py +0 -0
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/data/queries/examples/.gitkeep +0 -0
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/data/read.py +0 -0
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/environment/__init__.py +0 -0
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/environment/filesystem.py +0 -0
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/environment/logging.py +1 -1
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/environment/memoisation.py +0 -0
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/environment/oauth.py +0 -0
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/environment/webdrivers.py +0 -0
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/export/__init__.py +0 -0
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/export/images.py +0 -0
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/export/pdf.py +0 -0
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/interfaces/__init__.py +0 -0
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/interfaces/microsoft.py +0 -0
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/interfaces/streamlit.py +0 -0
- {mayutils-1.0.89/src/mayutils/objects → mayutils-1.2.0/src/mayutils}/mathematics/numba.py +0 -0
- {mayutils-1.0.89/src/mayutils/objects → mayutils-1.2.0/src/mayutils}/mathematics/numpy.py +0 -0
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/objects/__init__.py +0 -0
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/objects/classes.py +0 -0
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/objects/dataframes.py +0 -0
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/objects/decorators.py +0 -0
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/objects/dictionaries.py +0 -0
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/objects/functions.py +0 -0
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/objects/hashing.py +0 -0
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/objects/numbers.py +0 -0
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/objects/strings.py +0 -0
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/objects/types.py +0 -0
- {mayutils-1.0.89/src/mayutils/objects/mathematics → mayutils-1.2.0/src/mayutils/scripts}/__init__.py +0 -0
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/scripts/versioning.py +0 -0
- {mayutils-1.0.89/src/mayutils/scripts → mayutils-1.2.0/src/mayutils/testing}/__init__.py +0 -0
- {mayutils-1.0.89/src/mayutils/testing → mayutils-1.2.0/src/mayutils/visualisation}/__init__.py +0 -0
- {mayutils-1.0.89 → mayutils-1.2.0}/src/mayutils/visualisation/console.py +0 -0
- {mayutils-1.0.89/src/mayutils/visualisation → mayutils-1.2.0/src/mayutils/visualisation/graphs/matplotlib}/__init__.py +0 -0
mayutils-1.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: mayutils
|
|
3
|
+
Version: 1.2.0
|
|
4
|
+
Summary: Utilities for Python from Mayuran Visakan
|
|
5
|
+
Author: Mayuran Visakan
|
|
6
|
+
Author-email: Mayuran Visakan <mayuran.k.v@gmail.com>
|
|
7
|
+
License: MIT License
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2025 Mayuran Visakan
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions:
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
|
28
|
+
Requires-Dist: asyncer>=0.0.8
|
|
29
|
+
Requires-Dist: chromedriver-autoinstaller>=0.6.4
|
|
30
|
+
Requires-Dist: dataframe-image>=0.2.7
|
|
31
|
+
Requires-Dist: gitpython>=3.1.45
|
|
32
|
+
Requires-Dist: google-api-python-client>=2.179.0
|
|
33
|
+
Requires-Dist: google-auth>=2.40.3
|
|
34
|
+
Requires-Dist: google-auth-httplib2>=0.2.0
|
|
35
|
+
Requires-Dist: google-auth-oauthlib>=1.2.2
|
|
36
|
+
Requires-Dist: google-cloud-storage>=3.3.0
|
|
37
|
+
Requires-Dist: great-tables>=0.18.0
|
|
38
|
+
Requires-Dist: html2image>=2.0.7
|
|
39
|
+
Requires-Dist: ipykernel>=6.30.1
|
|
40
|
+
Requires-Dist: itables>=2.4.5
|
|
41
|
+
Requires-Dist: jupyter>=1.1.1
|
|
42
|
+
Requires-Dist: kaleido>=1.0.0
|
|
43
|
+
Requires-Dist: keyring>=25.6.0
|
|
44
|
+
Requires-Dist: matplotlib>=3.10.5
|
|
45
|
+
Requires-Dist: modin[all]>=0.35.0
|
|
46
|
+
Requires-Dist: nbconvert>=7.16.6
|
|
47
|
+
Requires-Dist: numba>=0.62.0rc1
|
|
48
|
+
Requires-Dist: numpy>=2.3.2
|
|
49
|
+
Requires-Dist: numpy-financial>=1.0.0
|
|
50
|
+
Requires-Dist: pandas>=2.3.2
|
|
51
|
+
Requires-Dist: pathlib>=1.0.1
|
|
52
|
+
Requires-Dist: pendulum[test]>=3.1.0
|
|
53
|
+
Requires-Dist: pillow>=11.3.0
|
|
54
|
+
Requires-Dist: playwright>=1.55.0
|
|
55
|
+
Requires-Dist: plotly>=6.3.0
|
|
56
|
+
Requires-Dist: polars>=1.32.3
|
|
57
|
+
Requires-Dist: pre-commit>=4.3.0
|
|
58
|
+
Requires-Dist: pyarrow>=21.0.0
|
|
59
|
+
Requires-Dist: pydantic>=2.11.7
|
|
60
|
+
Requires-Dist: pydantic-settings>=2.10.1
|
|
61
|
+
Requires-Dist: pymupdf>=1.26.4
|
|
62
|
+
Requires-Dist: python-dotenv>=1.1.1
|
|
63
|
+
Requires-Dist: python-pptx>=1.0.2
|
|
64
|
+
Requires-Dist: requests>=2.32.5
|
|
65
|
+
Requires-Dist: rich>=14.1.0
|
|
66
|
+
Requires-Dist: scikit-learn>=1.7.1
|
|
67
|
+
Requires-Dist: scipy>=1.16.1
|
|
68
|
+
Requires-Dist: selenium>=4.35.0
|
|
69
|
+
Requires-Dist: snowflake-connector-python[secure-local-storage]>=3.17.2
|
|
70
|
+
Requires-Dist: snowflake-sqlalchemy>=1.7.6
|
|
71
|
+
Requires-Dist: sqlalchemy>=2.0.43
|
|
72
|
+
Requires-Dist: streamlit>=1.49.0
|
|
73
|
+
Requires-Dist: typer>=0.16.1
|
|
74
|
+
Requires-Dist: unicodeit>=0.7.5
|
|
75
|
+
Requires-Dist: ruff>=0.9.6 ; extra == 'dev'
|
|
76
|
+
Requires-Dist: mypy>=1.15.0 ; extra == 'dev'
|
|
77
|
+
Requires-Dist: pytest>=8.3.4 ; extra == 'dev'
|
|
78
|
+
Requires-Dist: hatch>=1.14.0 ; extra == 'dev'
|
|
79
|
+
Requires-Python: >=3.11, <4.0
|
|
80
|
+
Provides-Extra: dev
|
|
81
|
+
Description-Content-Type: text/markdown
|
|
82
|
+
|
|
83
|
+
# Mayutils
|
|
84
|
+
|
|
85
|
+
Utilities for Python
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "mayutils"
|
|
3
|
+
version = "1.2.0"
|
|
4
|
+
description = "Utilities for Python from Mayuran Visakan"
|
|
5
|
+
authors = [
|
|
6
|
+
{ name = "Mayuran Visakan", email = "mayuran.k.v@gmail.com" }
|
|
7
|
+
]
|
|
8
|
+
license = { file = "LICENSE" }
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.11,<4.0"
|
|
11
|
+
dependencies = [
|
|
12
|
+
"asyncer>=0.0.8",
|
|
13
|
+
"chromedriver-autoinstaller>=0.6.4",
|
|
14
|
+
"dataframe-image>=0.2.7",
|
|
15
|
+
"gitpython>=3.1.45",
|
|
16
|
+
"google-api-python-client>=2.179.0",
|
|
17
|
+
"google-auth>=2.40.3",
|
|
18
|
+
"google-auth-httplib2>=0.2.0",
|
|
19
|
+
"google-auth-oauthlib>=1.2.2",
|
|
20
|
+
"google-cloud-storage>=3.3.0",
|
|
21
|
+
"great-tables>=0.18.0",
|
|
22
|
+
"html2image>=2.0.7",
|
|
23
|
+
"ipykernel>=6.30.1",
|
|
24
|
+
"itables>=2.4.5",
|
|
25
|
+
"jupyter>=1.1.1",
|
|
26
|
+
"kaleido>=1.0.0",
|
|
27
|
+
"keyring>=25.6.0",
|
|
28
|
+
"matplotlib>=3.10.5",
|
|
29
|
+
"modin[all]>=0.35.0",
|
|
30
|
+
"nbconvert>=7.16.6",
|
|
31
|
+
"numba>=0.62.0rc1",
|
|
32
|
+
"numpy>=2.3.2",
|
|
33
|
+
"numpy-financial>=1.0.0",
|
|
34
|
+
"pandas>=2.3.2",
|
|
35
|
+
"pathlib>=1.0.1",
|
|
36
|
+
"pendulum[test]>=3.1.0",
|
|
37
|
+
"pillow>=11.3.0",
|
|
38
|
+
"playwright>=1.55.0",
|
|
39
|
+
"plotly>=6.3.0",
|
|
40
|
+
"polars>=1.32.3",
|
|
41
|
+
"pre-commit>=4.3.0",
|
|
42
|
+
"pyarrow>=21.0.0",
|
|
43
|
+
"pydantic>=2.11.7",
|
|
44
|
+
"pydantic-settings>=2.10.1",
|
|
45
|
+
"pymupdf>=1.26.4",
|
|
46
|
+
"python-dotenv>=1.1.1",
|
|
47
|
+
"python-pptx>=1.0.2",
|
|
48
|
+
"requests>=2.32.5",
|
|
49
|
+
"rich>=14.1.0",
|
|
50
|
+
"scikit-learn>=1.7.1",
|
|
51
|
+
"scipy>=1.16.1",
|
|
52
|
+
"selenium>=4.35.0",
|
|
53
|
+
"snowflake-connector-python[secure-local-storage]>=3.17.2",
|
|
54
|
+
"snowflake-sqlalchemy>=1.7.6",
|
|
55
|
+
"sqlalchemy>=2.0.43",
|
|
56
|
+
"streamlit>=1.49.0",
|
|
57
|
+
"typer>=0.16.1",
|
|
58
|
+
"unicodeit>=0.7.5",
|
|
59
|
+
]
|
|
60
|
+
|
|
61
|
+
[project.optional-dependencies]
|
|
62
|
+
dev = [
|
|
63
|
+
"ruff>=0.9.6",
|
|
64
|
+
"mypy>=1.15.0",
|
|
65
|
+
"pytest>=8.3.4",
|
|
66
|
+
"hatch>=1.14.0"
|
|
67
|
+
]
|
|
68
|
+
|
|
69
|
+
[project.scripts]
|
|
70
|
+
clear_cache = "mayutils.scripts.clear_cache:app"
|
|
71
|
+
generate_encryption_key = "mayutils.environment.oauth:generate_fernet_key"
|
|
72
|
+
|
|
73
|
+
[tool.uv]
|
|
74
|
+
prerelease = "if-necessary-or-explicit"
|
|
75
|
+
|
|
76
|
+
[build-system]
|
|
77
|
+
requires = ["uv_build>=0.8.14,<0.9.0"]
|
|
78
|
+
build-backend = "uv_build"
|
|
Binary file
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import warnings
|
|
3
|
+
from importlib import metadata
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
__version__ = metadata.version(distribution_name="mayutils")
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def setup(
|
|
10
|
+
is_script: bool = False,
|
|
11
|
+
) -> None:
|
|
12
|
+
from mayutils.environment.logging import Logger
|
|
13
|
+
|
|
14
|
+
Logger.configure()
|
|
15
|
+
|
|
16
|
+
try:
|
|
17
|
+
from mayutils.objects.dataframes import setup_dataframes
|
|
18
|
+
from mayutils.visualisation.notebook import setup_notebooks
|
|
19
|
+
|
|
20
|
+
setup_notebooks()
|
|
21
|
+
setup_dataframes()
|
|
22
|
+
|
|
23
|
+
except ImportError as err:
|
|
24
|
+
Logger.spawn().warning(f"Error occurred during setup imports: {err}")
|
|
25
|
+
|
|
26
|
+
# TODO: Remove when dependency is upgraded
|
|
27
|
+
warnings.filterwarnings(
|
|
28
|
+
action="ignore",
|
|
29
|
+
message="You have an incompatible version of 'pyarrow' installed.*",
|
|
30
|
+
category=UserWarning,
|
|
31
|
+
module="snowflake.connector.options",
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
print(Path(sys.argv[0]).parent)
|
|
36
|
+
|
|
37
|
+
setup()
|
|
Binary file
|
|
Binary file
|
|
@@ -7,11 +7,10 @@ from shlex import quote as escape
|
|
|
7
7
|
from rich.progress import Progress, SpinnerColumn, TextColumn, TimeElapsedColumn
|
|
8
8
|
|
|
9
9
|
from mayutils.visualisation.notebook import (
|
|
10
|
-
|
|
10
|
+
not_nbconvert,
|
|
11
11
|
write_markdown,
|
|
12
12
|
)
|
|
13
13
|
from mayutils.export import OUTPUT_FOLDER
|
|
14
|
-
from mayutils.core.constants import DISPLAY_TYPE_ENV_VAR
|
|
15
14
|
|
|
16
15
|
WARNING = "Not an ipython notebook"
|
|
17
16
|
|
|
@@ -30,7 +29,7 @@ SLIDES_FOLDER = OUTPUT_FOLDER / "Slides"
|
|
|
30
29
|
|
|
31
30
|
|
|
32
31
|
def is_slides() -> bool:
|
|
33
|
-
return os.getenv(key=
|
|
32
|
+
return os.getenv(key="_NBCONVERT_OUTPUT_FORMAT", default=None) == "slides"
|
|
34
33
|
|
|
35
34
|
|
|
36
35
|
def subtitle_text(
|
|
@@ -58,7 +57,7 @@ def export_slides(
|
|
|
58
57
|
serve: bool = False,
|
|
59
58
|
light: bool = False,
|
|
60
59
|
) -> Path | None:
|
|
61
|
-
if not
|
|
60
|
+
if not not_nbconvert():
|
|
62
61
|
return None
|
|
63
62
|
|
|
64
63
|
today = date.today().strftime(
|
|
@@ -87,7 +86,7 @@ def export_slides(
|
|
|
87
86
|
total=None,
|
|
88
87
|
)
|
|
89
88
|
call(
|
|
90
|
-
args=f"
|
|
89
|
+
args=f"_NBCONVERT_OUTPUT_FORMAT=slides jupyter nbconvert {escape(filepath)} --output {escape(str(output_filepath))} --execute {'' if theme is None else ('--template=' + theme[0])} --to slides --no-input --no-prompt{'' if not serve else ' --post serve'} --SlidesExporter.reveal_scroll=True --SlidesExporter.reveal_number=c/t --SlidesExporter.reveal_theme={'simple' if light else 'night'} {'' if theme is None else ('--TemplateExporter.extra_template_basedirs=' + theme[1])}",
|
|
91
90
|
shell=True,
|
|
92
91
|
)
|
|
93
92
|
|
|
@@ -1050,7 +1050,8 @@ class Sheet(object):
|
|
|
1050
1050
|
|
|
1051
1051
|
return self.update_values(
|
|
1052
1052
|
range=f"{self.title}!{'A1' if range is None else range}",
|
|
1053
|
-
values=[df_with_index.columns.to_list()]
|
|
1053
|
+
values=[df_with_index.columns.to_list()]
|
|
1054
|
+
+ df_with_index.to_numpy().tolist(), # type: ignore
|
|
1054
1055
|
as_user=as_user,
|
|
1055
1056
|
)
|
|
1056
1057
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from typing import get_args, Literal
|
|
2
|
+
|
|
3
|
+
type Scale = Literal["relative", "absolute", "percentage"]
|
|
4
|
+
type Operation = Literal[
|
|
5
|
+
"division",
|
|
6
|
+
"normalise",
|
|
7
|
+
"standardise",
|
|
8
|
+
"dot_product",
|
|
9
|
+
"inverse",
|
|
10
|
+
"constant",
|
|
11
|
+
"drop",
|
|
12
|
+
]
|
|
13
|
+
type Calculations = dict[Operation, dict[str, tuple[str, ...]]]
|
|
14
|
+
|
|
15
|
+
OPERATIONS: tuple = get_args(Operation.__value__)
|
|
@@ -10,6 +10,77 @@ from mayutils.objects.classes import (
|
|
|
10
10
|
reverse_colourmap: dict[str, str] = {value: key for key, value in colormap.items()} # type: ignore
|
|
11
11
|
|
|
12
12
|
|
|
13
|
+
MAIN_COLOURSCALE = dict(
|
|
14
|
+
quartz="#FFCCFF",
|
|
15
|
+
pink="#FF97FF",
|
|
16
|
+
bubblegum="#FF85FF",
|
|
17
|
+
cherry="#FF6692",
|
|
18
|
+
red="#EF553B",
|
|
19
|
+
copper="#CF4915",
|
|
20
|
+
coral="#FFA15A",
|
|
21
|
+
orange="#FF9C12",
|
|
22
|
+
peach="#FFBD8E",
|
|
23
|
+
amber="#FECB52",
|
|
24
|
+
yellow="#FFE989",
|
|
25
|
+
lime="#B6E880",
|
|
26
|
+
green="#3BDB5F",
|
|
27
|
+
teal="#00cc96",
|
|
28
|
+
mint="#73DBB6",
|
|
29
|
+
cyan="#30D5DB",
|
|
30
|
+
sky="#19d3f3",
|
|
31
|
+
blue="#636efa",
|
|
32
|
+
periwinkle="#9299FD",
|
|
33
|
+
purple="#ab63fa",
|
|
34
|
+
mauve="#C592FD",
|
|
35
|
+
lavender="#DEBFFF",
|
|
36
|
+
)
|
|
37
|
+
SIMPLE_COLOURS = dict(
|
|
38
|
+
lightgreen="#73DBB6",
|
|
39
|
+
darkgreen="#3BDB5F",
|
|
40
|
+
cyan="#30D5DB",
|
|
41
|
+
blue="#9299FD",
|
|
42
|
+
yellow="#FFE989",
|
|
43
|
+
orange="#FFBD8E",
|
|
44
|
+
red="#F58B78",
|
|
45
|
+
purple="#C592FD",
|
|
46
|
+
lightpink="#FFCCFF",
|
|
47
|
+
pink="#FF85FF",
|
|
48
|
+
)
|
|
49
|
+
BASE_COLOURSCALE = list(MAIN_COLOURSCALE.values())
|
|
50
|
+
CONTINUOUS_COLORSCALE = [
|
|
51
|
+
[0.0, "#0d0887"],
|
|
52
|
+
[0.1111111111111111, "#46039f"],
|
|
53
|
+
[0.2222222222222222, "#7201a8"],
|
|
54
|
+
[0.3333333333333333, "#9c179e"],
|
|
55
|
+
[0.4444444444444444, "#bd3786"],
|
|
56
|
+
[0.5555555555555556, "#d8576b"],
|
|
57
|
+
[0.6666666666666666, "#ed7953"],
|
|
58
|
+
[0.7777777777777778, "#fb9f3a"],
|
|
59
|
+
[0.8888888888888888, "#fdca26"],
|
|
60
|
+
[1.0, "#f0f921"],
|
|
61
|
+
]
|
|
62
|
+
DIVERGENT_COLOURSCALE = [
|
|
63
|
+
[0, "#8e0152"],
|
|
64
|
+
[0.1, "#c51b7d"],
|
|
65
|
+
[0.2, "#de77ae"],
|
|
66
|
+
[0.3, "#f1b6da"],
|
|
67
|
+
[0.4, "#fde0ef"],
|
|
68
|
+
[0.5, "#f7f7f7"],
|
|
69
|
+
[0.6, "#e6f5d0"],
|
|
70
|
+
[0.7, "#b8e186"],
|
|
71
|
+
[0.8, "#7fbc41"],
|
|
72
|
+
[0.9, "#4d9221"],
|
|
73
|
+
[1, "#276419"],
|
|
74
|
+
]
|
|
75
|
+
|
|
76
|
+
OPACITIES = {
|
|
77
|
+
"primary": 1.0,
|
|
78
|
+
"secondary": 0.5,
|
|
79
|
+
"tertiary": 0.4,
|
|
80
|
+
"quaternary": 0.3,
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
|
|
13
84
|
@dataclass
|
|
14
85
|
class Colour:
|
|
15
86
|
r: float
|
|
@@ -82,7 +153,7 @@ class Colour:
|
|
|
82
153
|
|
|
83
154
|
def _html_show(
|
|
84
155
|
self,
|
|
85
|
-
size: int=50,
|
|
156
|
+
size: int = 50,
|
|
86
157
|
) -> str:
|
|
87
158
|
return f'<div style="width:{size}px;height:{size}px;background-color:{self.to_str()};"></div>'
|
|
88
159
|
|
|
@@ -260,3 +331,9 @@ def hex_to_rgba(
|
|
|
260
331
|
return f"rgba({values[0]}, {values[1]}, {values[2]}, {alpha})"
|
|
261
332
|
else:
|
|
262
333
|
raise ValueError("Invalid hex colour format. Use #RRGGBB or #RRGGBBAA")
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
TRANSPARENT = Colour.parse(colour="rgba(0,0,0,0)")
|
|
337
|
+
SPECTRUM = {
|
|
338
|
+
name: Colour.parse(colour=colour) for name, colour in MAIN_COLOURSCALE.items()
|
|
339
|
+
}
|