Skip to content

Commit 4825532

Browse files
committed
style: fix lints and formatting issues
- Run pre-commit to fix trailing whitespaces and formatting. - Replace bare print statements in preprocess script with sys logging to fix ruff T201.
1 parent bd99dcb commit 4825532

9 files changed

Lines changed: 9 additions & 13 deletions

File tree

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,11 @@ uv sync
6262
./generate_models.sh <version>
6363
```
6464

65-
Where `<version>` is the version of the UCP specification to use (for example, "2026-01-23").
65+
Where `<version>` is the version of the UCP specification to use (for example,
66+
"2026-01-23").
6667

67-
If no version is specified, the `main` branch of the [UCP repo](https://github.com/Universal-Commerce-Protocol/ucp) will be used.
68+
If no version is specified, the `main` branch of the
69+
[UCP repo](https://github.com/Universal-Commerce-Protocol/ucp) will be used.
6870

6971
The generated code is automatically formatted using `ruff`.
7072

preprocess_schemas.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
def load_json(path):
2424
"""Loads JSON data from a file."""
25-
with open(path, "r") as f:
25+
with open(path) as f:
2626
return json.load(f)
2727

2828

@@ -393,7 +393,7 @@ def generate_variants(path, schema, ops, global_variant_requirements):
393393
)
394394
out = file_path.parent / f"{file_path.stem}_{op}_request.json"
395395
save_json(variant, out)
396-
print(f"Generated variant: {out}")
396+
sys.stdout.write(f"Generated variant: {out}\n")
397397

398398

399399
# --- Global Normalization ---
@@ -500,7 +500,7 @@ def main():
500500
sys.argv[1] if len(sys.argv) > 1 else "ucp/source/schemas"
501501
)
502502
if not target_dir.exists():
503-
print(f"Error: Directory {target_dir} not found.")
503+
sys.stderr.write(f"Error: Directory {target_dir} not found.\n")
504504
return
505505

506506
schemas, schema_refs, variant_needs = {}, {}, {}
@@ -512,7 +512,7 @@ def main():
512512
p_abs = str(f.resolve())
513513
schemas[p_abs] = s
514514
except Exception as e:
515-
print(f"Failed to load {f}: {e}")
515+
sys.stderr.write(f"Failed to load {f}: {e}\n")
516516

517517
# Phase 0: Ensure the metadata 'ucp' property is consistent across all files
518518
normalize_metadata_schemas(schemas, target_dir)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,4 @@ convention = "google"
6767
[tool.ruff.lint.isort]
6868
combine-as-imports = true
6969
force-sort-within-sections = true
70-
case-sensitive = true
70+
case-sensitive = true

src/ucp_sdk/models/schemas/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,3 @@
1515
# generated by datamodel-codegen
1616
# pylint: disable=all
1717
# pyformat: disable
18-

src/ucp_sdk/models/schemas/shopping/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,3 @@
1515
# generated by datamodel-codegen
1616
# pylint: disable=all
1717
# pyformat: disable
18-

src/ucp_sdk/models/schemas/shopping/fulfillment/dev/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,3 @@
1515
# generated by datamodel-codegen
1616
# pylint: disable=all
1717
# pyformat: disable
18-

src/ucp_sdk/models/schemas/shopping/fulfillment/dev/ucp/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,3 @@
1515
# generated by datamodel-codegen
1616
# pylint: disable=all
1717
# pyformat: disable
18-

src/ucp_sdk/models/schemas/shopping/types/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,3 @@
1515
# generated by datamodel-codegen
1616
# pylint: disable=all
1717
# pyformat: disable
18-

src/ucp_sdk/models/schemas/transports/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,3 @@
1515
# generated by datamodel-codegen
1616
# pylint: disable=all
1717
# pyformat: disable
18-

0 commit comments

Comments
 (0)