From 3d73c55b204b60d84cc7c25ce5515fb6c90e0229 Mon Sep 17 00:00:00 2001 From: Kartik Singhal Date: Mon, 6 May 2024 05:47:58 -0500 Subject: [PATCH] fix: make None default size if unspecified (#84) --- .pre-commit-config.yaml | 4 ++-- phir/model.py | 2 +- schema.json | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 55e7b80..2099db6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,7 +15,7 @@ repos: - id: check-json - repo: https://github.com/crate-ci/typos - rev: v1.20.10 + rev: v1.21.0 hooks: - id: typos args: [] @@ -43,7 +43,7 @@ repos: - black==23.10.1 - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.4.2 + rev: v0.4.3 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] diff --git a/phir/model.py b/phir/model.py index f0eb2f5..f371888 100644 --- a/phir/model.py +++ b/phir/model.py @@ -45,7 +45,7 @@ class CVarDefine(Data): data: Literal["cvar_define"] data_type: Literal["i64", "i32", "u64", "u32"] variable: Sym - size: PositiveInt | None = Field(strict=True) + size: PositiveInt | None = Field(default=None, strict=True) @model_validator(mode="after") def check_size(self: CVarDefine) -> CVarDefine: diff --git a/schema.json b/schema.json index be230c9..df96668 100644 --- a/schema.json +++ b/schema.json @@ -190,14 +190,14 @@ "type": "null" } ], + "default": null, "title": "Size" } }, "required": [ "data", "data_type", - "variable", - "size" + "variable" ], "title": "CVarDefine", "type": "object"