refactor: Enable G logging rules and comprehensive ruff improvements (#35081)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Maxime Beauchemin
2025-09-15 12:42:49 -07:00
committed by GitHub
parent e1a2e4843a
commit 088ecdd0bf
47 changed files with 340 additions and 184 deletions

View File

@@ -59,7 +59,7 @@ def load_bart_lines(only_metadata: bool = False, force: bool = False) -> None:
index=False,
)
logger.debug(f"Creating table {tbl_name} reference")
logger.debug("Creating table %s reference", tbl_name)
table = get_table_connector_registry()
tbl = db.session.query(table).filter_by(table_name=tbl_name).first()
if not tbl:

View File

@@ -108,7 +108,7 @@ def load_birth_names(
table = get_table_connector_registry()
obj = db.session.query(table).filter_by(table_name=tbl_name, schema=schema).first()
if not obj:
logger.debug(f"Creating table [{tbl_name}] reference")
logger.debug("Creating table [%s] reference", tbl_name)
obj = table(table_name=tbl_name, schema=schema)
db.session.add(obj)
@@ -138,13 +138,14 @@ def _add_table_metrics(datasource: SqlaTable) -> None:
columns.append(
TableColumn(
column_name="num_california",
expression=f"CASE WHEN {col_state} = 'CA' THEN {col_num} ELSE 0 END",
expression="CASE WHEN %s = 'CA' THEN %s ELSE 0 END"
% (col_state, col_num),
)
)
if not any(col.metric_name == "sum__num" for col in metrics):
col = str(column("num").compile(db.engine))
metrics.append(SqlMetric(metric_name="sum__num", expression=f"SUM({col})"))
metrics.append(SqlMetric(metric_name="sum__num", expression="SUM(%s)" % col))
for col in columns:
if col.column_name == "ds": # type: ignore

View File

@@ -84,7 +84,7 @@ def load_multiformat_time_series( # pylint: disable=too-many-locals
logger.debug("Done loading table!")
logger.debug("-" * 80)
logger.debug(f"Creating table [{tbl_name}] reference")
logger.debug("Creating table [%s] reference", tbl_name)
table = get_table_connector_registry()
obj = db.session.query(table).filter_by(table_name=tbl_name).first()
if not obj:
@@ -125,7 +125,7 @@ def load_multiformat_time_series( # pylint: disable=too-many-locals
}
slc = Slice(
slice_name=f"Calendar Heatmap multiformat {i}",
slice_name="Calendar Heatmap multiformat %s" % i,
viz_type="cal_heatmap",
datasource_type=DatasourceType.TABLE,
datasource_id=tbl.id,

View File

@@ -55,7 +55,7 @@ def load_paris_iris_geojson(only_metadata: bool = False, force: bool = False) ->
index=False,
)
logger.debug(f"Creating table {tbl_name} reference")
logger.debug("Creating table %s reference", tbl_name)
table = get_table_connector_registry()
tbl = db.session.query(table).filter_by(table_name=tbl_name).first()
if not tbl:

View File

@@ -68,7 +68,7 @@ def load_random_time_series_data(
logger.debug("Done loading table!")
logger.debug("-" * 80)
logger.debug(f"Creating table [{tbl_name}] reference")
logger.debug("Creating table [%s] reference", tbl_name)
table = get_table_connector_registry()
obj = db.session.query(table).filter_by(table_name=tbl_name).first()
if not obj:

View File

@@ -59,7 +59,7 @@ def load_sf_population_polygons(
index=False,
)
logger.debug(f"Creating table {tbl_name} reference")
logger.debug("Creating table %s reference", tbl_name)
table = get_table_connector_registry()
tbl = db.session.query(table).filter_by(table_name=tbl_name).first()
if not tbl: