Skip to content

Commit df1b960

Browse files
authored
Increase line length to 100 (#356)
* Increase line length to 100 * black restyle after rebase
1 parent b418681 commit df1b960

100 files changed

Lines changed: 483 additions & 1416 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.pre-commit-config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ repos:
2121
args:
2222
- --target-version
2323
- py37
24+
- --line-length
25+
- '100'
2426
entry: black
2527
require_serial: true
2628
files: *files

examples/airflow/docker_compose_decorator.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,7 @@
115115
environment_variables[
116116
"AIRFLOW_CONN_GITHUB_DEFAULT"
117117
] = '{"conn_type": "github", "password": "${DEMO_GITHUB_PAT}"}'
118-
docker_compose["services"][airflow_component]["environment"].update(
119-
environment_variables
120-
)
118+
docker_compose["services"][airflow_component]["environment"].update(environment_variables)
121119

122120

123121
with open(DOCKER_COMPOSE_YAML, "w", encoding="utf-8") as fd:

examples/sushi/macros/macros.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,9 @@ def add_one(evaluator: MacroEvaluator, column: str) -> exp.Expression:
1313
@macro()
1414
def incremental_by_ds(evaluator: MacroEvaluator, column: exp.Column) -> exp.Expression:
1515
expression = evaluator.transform(
16-
exp.Between(
17-
this=column, low=MacroVar(this="start_ds"), high=MacroVar(this="end_ds")
18-
)
16+
exp.Between(this=column, low=MacroVar(this="start_ds"), high=MacroVar(this="end_ds"))
1917
)
2018
if not isinstance(expression, exp.Expression):
21-
raise MacroEvalError(
22-
f"Return type is {type(expression)}, expected exp.Expression"
23-
)
19+
raise MacroEvalError(f"Return type is {type(expression)}, expected exp.Expression")
2420

2521
return expression

examples/sushi/models/order_items.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,7 @@
2929
audits=[
3030
(
3131
"not_null",
32-
{
33-
"columns": [
34-
to_column(c) for c in ("id", "order_id", "item_id", "quantity")
35-
]
36-
},
32+
{"columns": [to_column(c) for c in ("id", "order_id", "item_id", "quantity")]},
3733
),
3834
("assert_order_items_quantity_exceeds_threshold", {"quantity": 0}),
3935
],

examples/wursthall/models/db/order_f.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@
2525

2626
@model(
2727
"db.order_f",
28-
kind=IncrementalByTimeRangeKind(
29-
time_column=TimeColumn(column="order_ds", format="%Y-%m-%d")
30-
),
28+
kind=IncrementalByTimeRangeKind(time_column=TimeColumn(column="order_ds", format="%Y-%m-%d")),
3129
start=DATA_START_DATE_STR,
3230
cron="@daily",
3331
batch_size=200,
@@ -69,9 +67,7 @@ def execute(
6967

7068
df_order_item_f = df_order_item_f.merge(df_item_d, how="inner", on="item_id")
7169
df_order_item_f["item_price"] = 1.00
72-
df_order_item_f["item_total"] = (
73-
df_order_item_f["item_price"] * df_order_item_f["quantity"]
74-
)
70+
df_order_item_f["item_total"] = df_order_item_f["item_price"] * df_order_item_f["quantity"]
7571
df_order_item_f = (
7672
df_order_item_f.groupby(["order_id", "customer_id", "order_ds"], dropna=False)
7773
.agg(order_total=("item_total", "sum"))

examples/wursthall/models/src/order_item_details.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ class OrderItemDetails:
2929

3030
@model(
3131
"src.order_item_details",
32-
kind=IncrementalByTimeRangeKind(
33-
time_column=TimeColumn(column="order_ds", format="%Y-%m-%d")
34-
),
32+
kind=IncrementalByTimeRangeKind(time_column=TimeColumn(column="order_ds", format="%Y-%m-%d")),
3533
start=DATA_START_DATE_STR,
3634
cron="@daily",
3735
batch_size=100,
@@ -99,9 +97,7 @@ def execute(
9997
)
10098
):
10199
item_id = str(
102-
df_menu_items.iloc[[random.choice(range(num_menu_items))]][
103-
"item_id"
104-
].values[0]
100+
df_menu_items.iloc[[random.choice(range(num_menu_items))]]["item_id"].values[0]
105101
)
106102
quantity = np.random.choice(range(1, 4), p=[0.8, 0.1, 0.1])
107103
results.append(

sqlmesh/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,7 @@ class CustomFormatter(logging.Formatter):
9696
red = "\x1b[31;20m"
9797
bold_red = "\x1b[31;1m"
9898
reset = "\x1b[0m"
99-
log_format = (
100-
"%(asctime)s - %(name)s - %(levelname)s - %(message)s (%(filename)s:%(lineno)d)"
101-
)
99+
log_format = "%(asctime)s - %(name)s - %(levelname)s - %(message)s (%(filename)s:%(lineno)d)"
102100

103101
FORMATS = {
104102
logging.DEBUG: grey + log_format + reset,

sqlmesh/cli/main.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,7 @@ def diff(ctx: click.Context, environment: t.Optional[str] = None) -> None:
219219
)
220220
@click.pass_context
221221
@error_handler
222-
def plan(
223-
ctx: click.Context, environment: t.Optional[str] = None, **kwargs: t.Any
224-
) -> None:
222+
def plan(ctx: click.Context, environment: t.Optional[str] = None, **kwargs: t.Any) -> None:
225223
"""Plan a migration of the current context's models with the given environment."""
226224
context = ctx.obj
227225
restate_models = kwargs.pop("restate_model", None)
@@ -238,9 +236,7 @@ def plan(
238236
)
239237
@click.pass_context
240238
@error_handler
241-
def run(
242-
ctx: click.Context, environment: t.Optional[str] = None, **kwargs: t.Any
243-
) -> None:
239+
def run(ctx: click.Context, environment: t.Optional[str] = None, **kwargs: t.Any) -> None:
244240
"""Evaluates the DAG of models using the built-in scheduler."""
245241
context = ctx.obj
246242
context.run(**kwargs)

sqlmesh/core/audit/definition.py

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,7 @@ class Audit(AuditMeta, frozen=True):
5353
"""
5454

5555
query: t.Union[exp.Subqueryable, d.Jinja]
56-
expressions_: t.Optional[t.List[exp.Expression]] = Field(
57-
default=None, alias="expressions"
58-
)
56+
expressions_: t.Optional[t.List[exp.Expression]] = Field(default=None, alias="expressions")
5957

6058
_path: t.Optional[pathlib.Path] = None
6159

@@ -77,9 +75,7 @@ def load(
7775
dialect: The default dialect if no audit dialect is configured.
7876
"""
7977
if len(expressions) < 2:
80-
_raise_config_error(
81-
"Incomplete audit definition, missing AUDIT or QUERY", path
82-
)
78+
_raise_config_error("Incomplete audit definition, missing AUDIT or QUERY", path)
8379

8480
meta, *statements, query = expressions
8581

@@ -92,9 +88,7 @@ def load(
9288

9389
provided_meta_fields = {p.name for p in meta.expressions}
9490

95-
missing_required_fields = AuditMeta.missing_required_fields(
96-
provided_meta_fields
97-
)
91+
missing_required_fields = AuditMeta.missing_required_fields(provided_meta_fields)
9892
if missing_required_fields:
9993
_raise_config_error(
10094
f"Missing required fields {missing_required_fields} in the audit definition",
@@ -121,11 +115,7 @@ def load(
121115
**{
122116
"dialect": dialect or "",
123117
**AuditMeta(
124-
**{
125-
prop.name: prop.args.get("value")
126-
for prop in meta.expressions
127-
if prop
128-
},
118+
**{prop.name: prop.args.get("value") for prop in meta.expressions if prop},
129119
).dict(),
130120
},
131121
)

sqlmesh/core/config/base.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,12 @@ def update_field(
6565
combined = old.copy()
6666
for key, value in new.items():
6767
if not isinstance(value, list):
68-
raise ConfigError(
69-
"KEY_EXTEND behavior requires list values in dictionary."
70-
)
68+
raise ConfigError("KEY_EXTEND behavior requires list values in dictionary.")
7169

7270
old_value = combined.get(key)
7371
if old_value:
7472
if not isinstance(old_value, list):
75-
raise ConfigError(
76-
"KEY_EXTEND behavior requires list values in dictionary."
77-
)
73+
raise ConfigError("KEY_EXTEND behavior requires list values in dictionary.")
7874

7975
combined[key] = old_value + value
8076
else:

0 commit comments

Comments
 (0)