Skip to content

Commit

Permalink
Chore: Format code using Ruff 0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Jan 13, 2025
1 parent 78ae5cd commit 6b1b40f
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 14 deletions.
3 changes: 1 addition & 2 deletions cratedb_toolkit/io/dynamodb/copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ def start(self):
logger.info(f"Bulk processor metrics: {metrics}")

logger.info(
"Number of records written: "
f"success={metrics.count_success_total}, error={metrics.count_error_total}"
f"Number of records written: success={metrics.count_success_total}, error={metrics.count_error_total}"
)
if metrics.count_success_total == 0:
logger.warning("No data has been copied")
Expand Down
2 changes: 1 addition & 1 deletion cratedb_toolkit/io/kinesis/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def iterator_type(self):
"""
if self.start.startswith("seqno"):
raise NotImplementedError(
"Consuming Kinesis Stream from sequence number " "not implemented yet, please file an issue."
"Consuming Kinesis Stream from sequence number not implemented yet, please file an issue."
)
try:
return self.start_iterator_type_map[self.start]
Expand Down
3 changes: 1 addition & 2 deletions cratedb_toolkit/io/mongodb/copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ def start(self):
logger.info(f"Bulk processor metrics: {metrics}")

logger.info(
"Number of records written: "
f"success={metrics.count_success_total}, error={metrics.count_error_total}"
f"Number of records written: success={metrics.count_success_total}, error={metrics.count_error_total}"
)
if metrics.count_success_total == 0:
logger.warning("No data has been copied")
Expand Down
2 changes: 1 addition & 1 deletion cratedb_toolkit/io/mongodb/translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def proportion_string(types: dict) -> str:
summary = "-- ⬇️ Types: "
proportions = []
for type_ in types:
proportions.append(f"{type_}: {round((types[type_]['count']/total)*100, 2)}%")
proportions.append(f"{type_}: {round((types[type_]['count'] / total) * 100, 2)}%")
return " " + (summary + ", ".join(proportions))


Expand Down
2 changes: 1 addition & 1 deletion cratedb_toolkit/retention/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def start(self):
Resolve retention policies to tasks, and invoke them.
"""
logger.info(
f"Connecting to database {self.settings.database.safe}, " f"table {self.settings.policy_table.fullname}"
f"Connecting to database {self.settings.database.safe}, table {self.settings.policy_table.fullname}"
)

msg = f"Starting data retention using '{self.settings.strategy}', cutoff day '{self.settings.cutoff_day}'"
Expand Down
2 changes: 1 addition & 1 deletion cratedb_toolkit/retention/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def __init__(self, settings: JobSettings):
self.settings = settings

logger.info(
f"Connecting to database {self.settings.database.safe}, " f"table {self.settings.policy_table.fullname}"
f"Connecting to database {self.settings.database.safe}, table {self.settings.policy_table.fullname}"
)

if self.settings.policy_table.table is None:
Expand Down
4 changes: 1 addition & 3 deletions cratedb_toolkit/wtf/query_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,7 @@ def write_stats_to_db():
f"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"
)
update_query_stmt = (
f"UPDATE {stmt_log_table} "
f"SET calls = ?, avg_duration = ?, nodes = ?, bucket = ?, last_used = ? "
f"WHERE id = ?"
f"UPDATE {stmt_log_table} SET calls = ?, avg_duration = ?, nodes = ?, bucket = ?, last_used = ? WHERE id = ?"
)
write_params = []
for key in sys_jobs_log.keys():
Expand Down
3 changes: 1 addition & 2 deletions examples/cloud_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ def obtain_cluster_id() -> str:

if not cluster_id:
raise ValueError(
"Unable to obtain cluster identifier from command line or "
"`CRATEDB_CLOUD_CLUSTER_ID` environment variable"
"Unable to obtain cluster identifier from command line or `CRATEDB_CLOUD_CLUSTER_ID` environment variable"
)

return cluster_id
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,8 @@ lint.select = [
]

lint.extend-ignore = [
# Module `xxx` shadows a Python standard-library module
"A005",
# zip() without an explicit strict= parameter
"B905",
# df is a bad variable name. Be kinder to your future self.
Expand Down
2 changes: 1 addition & 1 deletion tests/datasets/test_loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_dataset_replace(database: DatabaseAdapter, dataset: Dataset):
"KAGGLE_USERNAME" in os.environ and "KAGGLE_KEY" in os.environ
)
if dataset.title and "Weather" in dataset.title and not kaggle_auth_exists:
raise pytest.skip(f"Kaggle dataset can not be tested " f"without authentication: {dataset.reference}")
raise pytest.skip(f"Kaggle dataset can not be tested without authentication: {dataset.reference}")

dataset = load_dataset(dataset.reference)
tablename = slugify(dataset.reference, separator="_")
Expand Down

0 comments on commit 6b1b40f

Please sign in to comment.