Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/cifflow/dictionary/ddlm_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,17 @@ class DdlmDictionary:
warnings: list[str] = field(default_factory=list)
source_files: list[str] = field(default_factory=list)
uri: str | None = None

@property
def has_warnings(self) -> bool:
"""Return True if any non-fatal issues were recorded during loading.

Warnings range from purely informational (e.g. a dictionary with
multiple data blocks) to significant (e.g. a skipped import). A
dictionary with warnings is not necessarily unusable; inspect
:attr:`warnings` to determine severity.
"""
return bool(self.warnings)

# def __bool__(self) -> bool:
# return self.is_valid
10 changes: 7 additions & 3 deletions tasks/todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,13 @@ Decomposed all F-grade and all 6 reducible E-grade functions into private helper
ingest a real `.cif` to file-backed SQLite, emit to `.cif` and re-ingest, property-based
tests for `_BlockData` helpers.

4. **Unify severity levels** across parser/ingest/validation — audit every `on_error` /
`ParseError` site; assign `'Error' | 'Warning' | 'Info'`; standardise message phrasing;
decide `ingest()` return type.
4. **Unify severity levels** across parser/ingest/validation/dictionary — audit every `on_error` /
`ParseError` site and every `warn()` call in `loader.py`; assign `'Error' | 'Warning' | 'Info'`;
standardise message phrasing; decide `ingest()` return type. Dictionary warnings currently span
the full range from purely informational ("has 2 data blocks — using first") to effectively fatal
("contains no data blocks"), making `DdlmDictionary.is_valid` / `__bool__` meaningless as a
single threshold. Fix requires classifying each warning site before exposing validity on the
public API.

6. **`CifBuilder` cross-type duplicate tag detection** — scalar-then-loop silently loses
scalar; loop-then-scalar makes loop structurally inconsistent. Fix in `builder.py` with
Expand Down
Loading