axsdb 0.0.2__py3-none-any.whl
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.
- axsdb/__init__.py +27 -0
- axsdb/_version.py +8 -0
- axsdb/cli.py +75 -0
- axsdb/core.py +893 -0
- axsdb/error.py +200 -0
- axsdb/factory.py +135 -0
- axsdb/py.typed +0 -0
- axsdb/typing.py +4 -0
- axsdb/units.py +72 -0
- axsdb-0.0.2.dist-info/METADATA +30 -0
- axsdb-0.0.2.dist-info/RECORD +13 -0
- axsdb-0.0.2.dist-info/WHEEL +4 -0
- axsdb-0.0.2.dist-info/entry_points.txt +2 -0
axsdb/__init__.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from .core import (
|
|
2
|
+
AbsorptionDatabase,
|
|
3
|
+
CKDAbsorptionDatabase,
|
|
4
|
+
MonoAbsorptionDatabase,
|
|
5
|
+
)
|
|
6
|
+
from .factory import AbsorptionDatabaseFactory
|
|
7
|
+
from .error import (
|
|
8
|
+
get_error_handling_config,
|
|
9
|
+
set_error_handling_config,
|
|
10
|
+
ErrorHandlingAction,
|
|
11
|
+
ErrorHandlingPolicy,
|
|
12
|
+
ErrorHandlingConfiguration,
|
|
13
|
+
)
|
|
14
|
+
from ._version import version as __version__
|
|
15
|
+
|
|
16
|
+
__all__ = [
|
|
17
|
+
"AbsorptionDatabase",
|
|
18
|
+
"AbsorptionDatabaseFactory",
|
|
19
|
+
"ErrorHandlingAction",
|
|
20
|
+
"ErrorHandlingConfiguration",
|
|
21
|
+
"ErrorHandlingPolicy",
|
|
22
|
+
"CKDAbsorptionDatabase",
|
|
23
|
+
"MonoAbsorptionDatabase",
|
|
24
|
+
"get_error_handling_config",
|
|
25
|
+
"set_error_handling_config",
|
|
26
|
+
"__version__",
|
|
27
|
+
]
|
axsdb/_version.py
ADDED
axsdb/cli.py
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
from enum import Enum
|
|
5
|
+
from typing import Annotated
|
|
6
|
+
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
import typer
|
|
9
|
+
from rich.logging import RichHandler
|
|
10
|
+
|
|
11
|
+
logger = logging.getLogger("axsdb")
|
|
12
|
+
app = typer.Typer()
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class LogLevel(str, Enum):
|
|
16
|
+
CRITICAL = "CRITICAL"
|
|
17
|
+
ERROR = "ERROR"
|
|
18
|
+
WARNING = "WARNING"
|
|
19
|
+
INFO = "INFO"
|
|
20
|
+
DEBUG = "DEBUG"
|
|
21
|
+
NOTSET = "NOTSET"
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@app.callback()
|
|
25
|
+
def cli(
|
|
26
|
+
log_level: Annotated[
|
|
27
|
+
LogLevel, typer.Option(help="Set log level.")
|
|
28
|
+
] = LogLevel.WARNING,
|
|
29
|
+
debug: Annotated[
|
|
30
|
+
bool,
|
|
31
|
+
typer.Option(
|
|
32
|
+
help="Enable debug mode. This will notably print exceptions with locals."
|
|
33
|
+
),
|
|
34
|
+
] = False,
|
|
35
|
+
):
|
|
36
|
+
if debug:
|
|
37
|
+
app.pretty_exceptions_enable = True
|
|
38
|
+
|
|
39
|
+
logging.basicConfig(
|
|
40
|
+
level=log_level.name,
|
|
41
|
+
format="%(message)s",
|
|
42
|
+
datefmt="[%X]",
|
|
43
|
+
handlers=[RichHandler(rich_tracebacks=True)],
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
@app.command()
|
|
48
|
+
def check(
|
|
49
|
+
path: Annotated[Path, typer.Argument(help="Path to the checked database.")],
|
|
50
|
+
mode: Annotated[str, typer.Option("--mode", "-m", help="Database spectral mode.")],
|
|
51
|
+
fix: Annotated[
|
|
52
|
+
bool, typer.Option("--fix", "-f", help="Fix issues that can be.")
|
|
53
|
+
] = False,
|
|
54
|
+
):
|
|
55
|
+
"""
|
|
56
|
+
Check data for availability and integrity, optionally fix them.
|
|
57
|
+
"""
|
|
58
|
+
from axsdb.core import get_absdb_type
|
|
59
|
+
|
|
60
|
+
try:
|
|
61
|
+
cls = get_absdb_type(mode)
|
|
62
|
+
except ValueError:
|
|
63
|
+
logger.critical(f"Unsupported mode '{mode}'")
|
|
64
|
+
exit(1)
|
|
65
|
+
|
|
66
|
+
logger.info(f"Opening '{path}'")
|
|
67
|
+
try:
|
|
68
|
+
cls.from_directory(path, fix=fix)
|
|
69
|
+
logger.info("Success!")
|
|
70
|
+
except FileNotFoundError:
|
|
71
|
+
pass
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def main():
|
|
75
|
+
app()
|