Skip to content

Commit 78cf6e7

Browse files
committed
Chore: Format code using Ruff
1 parent 8201b4d commit 78cf6e7

File tree

9 files changed

+54
-52
lines changed

9 files changed

+54
-52
lines changed

cratedb_toolkit/api/cli.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from click import ClickException
33
from click_aliases import ClickAliasedGroup
44

5-
from cratedb_toolkit.options import option_cluster_id, option_cluster_name, option_sqlalchemy_url, option_http_url
5+
from cratedb_toolkit.options import option_cluster_id, option_cluster_name, option_http_url, option_sqlalchemy_url
66
from cratedb_toolkit.util.cli import boot_click
77

88

@@ -18,7 +18,14 @@ def make_cli():
1818
@click.version_option()
1919
@click.pass_context
2020
def cli(
21-
ctx: click.Context, cratedb_sqlalchemy_url: str, cratedb_http_url: str, verbose: bool, debug: bool, scrub: bool
21+
ctx: click.Context,
22+
cluster_id: str,
23+
cluster_name: str,
24+
cratedb_sqlalchemy_url: str,
25+
cratedb_http_url: str,
26+
verbose: bool,
27+
debug: bool,
28+
scrub: bool,
2229
):
2330
"""
2431
Diagnostics and informational utilities.

cratedb_toolkit/api/main.py

+4-9
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@
44
import sys
55
import time
66
import typing as t
7-
from pathlib import Path
8-
9-
from boltons.urlutils import URL
107
from functools import lru_cache
8+
from pathlib import Path
119

1210
import click
11+
from boltons.urlutils import URL
1312

1413
from cratedb_toolkit.api.guide import GuidingTexts
1514
from cratedb_toolkit.api.model import ClientBundle, ClusterBase
@@ -333,9 +332,7 @@ class StandaloneCluster(ClusterBase):
333332
address: DatabaseAddress
334333
info: t.Optional[ClusterInformation] = None
335334

336-
def load_table(
337-
self, source: InputOutputResource, target: TableAddress, transformation: t.Union[Path, None] = None
338-
):
335+
def load_table(self, source: InputOutputResource, target: TableAddress, transformation: t.Union[Path, None] = None):
339336
"""
340337
Load data into a database table on a standalone CrateDB Server.
341338
@@ -360,9 +357,7 @@ def load_table(
360357
return False
361358

362359
elif (
363-
source_url_obj.scheme.startswith("influxdb")
364-
or source_url.endswith(".lp")
365-
or source_url.endswith(".lp.gz")
360+
source_url_obj.scheme.startswith("influxdb") or source_url.endswith(".lp") or source_url.endswith(".lp.gz")
366361
):
367362
from cratedb_toolkit.io.influxdb import influxdb_copy
368363

cratedb_toolkit/cli.py

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
from .query.cli import cli as query_cli
1414
from .shell.cli import cli as shell_cli
1515
from .util.setting import init_dotenv
16-
from .wtf.cli import cli as wtf_cli
1716

1817

1918
@click.group(cls=ClickAliasedGroup) # type: ignore[arg-type]

cratedb_toolkit/cluster/cli.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
from click_aliases import ClickAliasedGroup
66

77
from cratedb_toolkit import ManagedCluster
8-
from cratedb_toolkit.options import option_cluster_id, option_cluster_name
98
from cratedb_toolkit.cluster.model import ClusterInformation
109
from cratedb_toolkit.exception import CroudException
10+
from cratedb_toolkit.options import option_cluster_id, option_cluster_name
1111
from cratedb_toolkit.util import jd
1212
from cratedb_toolkit.util.cli import boot_click, make_command
1313

cratedb_toolkit/shell/cli.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import click
22

3+
from cratedb_toolkit.cluster.model import ClusterInformation
34
from cratedb_toolkit.model import DatabaseAddress
45
from cratedb_toolkit.options import option_cluster_id, option_cluster_name, option_sqlalchemy_url
5-
from cratedb_toolkit.cluster.model import ClusterInformation
66
from cratedb_toolkit.util.cli import boot_click
77
from cratedb_toolkit.util.crash import get_crash_output_formats, run_crash
88

doc/info/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ ctk cfr --cratedb-http-url "https://username:password@localhost:4200/?schema=ext
2020
ctk cfr --cratedb-sqlalchemy-url "crate://username:password@localhost:4200/?schema=ext&ssl=true" jobstats collect
2121
```
2222

23-
Define CrateDB database cluster address per aa. Choose one of both alternatives.
23+
Define CrateDB database cluster address per environment variable. Choose one of both alternatives.
2424
```shell
2525
export CRATEDB_HTTP_URL=https://username:password@localhost:4200/?schema=ext
2626
```

examples/notebook/cloud_import.ipynb

+36-36
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5+
"metadata": {
6+
"collapsed": false
7+
},
58
"source": [
69
"# CrateDB Cloud Import\n",
710
"\n",
@@ -20,24 +23,24 @@
2023
"## Setup\n",
2124
"\n",
2225
"To install the client SDK, use `pip`."
23-
],
24-
"metadata": {
25-
"collapsed": false
26-
}
26+
]
2727
},
2828
{
2929
"cell_type": "code",
3030
"execution_count": null,
31+
"metadata": {
32+
"collapsed": false
33+
},
3134
"outputs": [],
3235
"source": [
3336
"#!pip install 'cratedb-toolkit'"
34-
],
35-
"metadata": {
36-
"collapsed": false
37-
}
37+
]
3838
},
3939
{
4040
"cell_type": "markdown",
41+
"metadata": {
42+
"collapsed": false
43+
},
4144
"source": [
4245
"## Configuration\n",
4346
"\n",
@@ -56,13 +59,13 @@
5659
"CRATEDB_USERNAME='admin'\n",
5760
"CRATEDB_PASSWORD='H3IgNXNvQBJM3CiElOiVHuSp6CjXMCiQYhB4I9dLccVHGvvvitPSYr1vTpt4'\n",
5861
"```"
59-
],
60-
"metadata": {
61-
"collapsed": false
62-
}
62+
]
6363
},
6464
{
6565
"cell_type": "markdown",
66+
"metadata": {
67+
"collapsed": false
68+
},
6669
"source": [
6770
"## Acquire Database Cluster\n",
6871
"\n",
@@ -71,10 +74,7 @@
7174
"\n",
7275
"For effortless configuration, it will obtain configuration settings from\n",
7376
"environment variables as defined above."
74-
],
75-
"metadata": {
76-
"collapsed": false
77-
}
77+
]
7878
},
7979
{
8080
"cell_type": "code",
@@ -84,13 +84,16 @@
8484
},
8585
"outputs": [],
8686
"source": [
87-
"from cratedb_toolkit import ManagedCluster, InputOutputResource\n",
87+
"from cratedb_toolkit import InputOutputResource, ManagedCluster\n",
8888
"\n",
8989
"cluster = ManagedCluster.from_env().start()"
9090
]
9191
},
9292
{
9393
"cell_type": "markdown",
94+
"metadata": {
95+
"collapsed": false
96+
},
9497
"source": [
9598
"## Import Data\n",
9699
"\n",
@@ -105,22 +108,22 @@
105108
"\n",
106109
"[NAB Data Corpus]: https://github.com/numenta/NAB/tree/master/data\n",
107110
"[MLflow and CrateDB]: https://github.com/crate/cratedb-examples/tree/main/topic/machine-learning/mlops-mlflow"
108-
],
109-
"metadata": {
110-
"collapsed": false
111-
}
111+
]
112112
},
113113
{
114114
"cell_type": "code",
115115
"execution_count": 4,
116+
"metadata": {
117+
"collapsed": false
118+
},
116119
"outputs": [
117120
{
118121
"name": "stderr",
119122
"output_type": "stream",
120123
"text": [
121-
"\u001B[36m==> Info: \u001B[0mStatus: REGISTERED (Your import job was received and is pending processing.)\n",
122-
"\u001B[36m==> Info: \u001B[0mDone importing 22.70K records\n",
123-
"\u001B[32m==> Success: \u001B[0mOperation completed.\n"
124+
"\u001b[36m==> Info: \u001b[0mStatus: REGISTERED (Your import job was received and is pending processing.)\n",
125+
"\u001b[36m==> Info: \u001b[0mDone importing 22.70K records\n",
126+
"\u001b[32m==> Success: \u001b[0mOperation completed.\n"
124127
]
125128
},
126129
{
@@ -140,26 +143,26 @@
140143
"# Invoke import job. Without `target` argument, the destination\n",
141144
"# table name will be derived from the input file name.\n",
142145
"cluster.load_table(source=source)"
143-
],
144-
"metadata": {
145-
"collapsed": false
146-
}
146+
]
147147
},
148148
{
149149
"cell_type": "markdown",
150+
"metadata": {
151+
"collapsed": false
152+
},
150153
"source": [
151154
"## Query Data\n",
152155
"\n",
153156
"In order to inspect if the dataset has been imported successfully, run an SQL\n",
154157
"command sampling a few records."
155-
],
156-
"metadata": {
157-
"collapsed": false
158-
}
158+
]
159159
},
160160
{
161161
"cell_type": "code",
162162
"execution_count": 5,
163+
"metadata": {
164+
"collapsed": false
165+
},
163166
"outputs": [
164167
{
165168
"data": {
@@ -173,10 +176,7 @@
173176
"source": [
174177
"# Query data.\n",
175178
"cluster.query('SELECT * FROM \"nab-machine-failure\" LIMIT 5;')"
176-
],
177-
"metadata": {
178-
"collapsed": false
179-
}
179+
]
180180
}
181181
],
182182
"metadata": {

examples/python/cloud_cluster.py

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
fall back to probe the environment variables.
6363
6464
"""
65+
6566
import json
6667
import logging
6768
import sys

tests/io/mongodb/conftest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
import pytest
55

6-
from tests.conftest import check_sqlalchemy2
76
from cratedb_toolkit.testing.testcontainers.util import PytestTestcontainerAdapter
7+
from tests.conftest import check_sqlalchemy2
88

99
logger = logging.getLogger(__name__)
1010

0 commit comments

Comments
 (0)