feat(metadata): dtype-Registry + Robustheit (PR1/4)#37
Merged
Conversation
Neues pure-stdlib-Modul sdata/dtypes.py als Single Source of Truth für Wert-Coercion, JSON-(De)Serialisierung, Python-Klasse und XSD-Typ-Mapping (Grundlage der späteren JSON-LD-Schicht). Verbesserungen (strikt additiv, lenient-Verhalten byte-genau erhalten): - timestamp-dtype jetzt implementiert (via sdata.timestamp.TimeStamp, ISO-8601/UTC). - bool-Coercion: lenient unverändert; strict=True case-insensitiv (yes/no/on/off…) und wirft bei Mehrdeutigkeit. - dtype akzeptiert Klasse ODER String (resolve); Wechsel des dtype castet den vorhandenen Wert um (bisheriger TODO). - neue dtypes bytes (base64), json (dict/list), uri (+ XSD: base64Binary/anyURI). - opt-in strict= (Attribute/set_attr) wirft DtypeError statt still zu degradieren. Bugfixes: - Metadata.name <-> _sdata_name als Single Source of Truth (keine Desync mehr). - relabel() schlüsselt explizit um (kein Präfix-Verlust). - update_hash() liefert das Hash-Objekt zurück (statt der builtin-hash-Klasse). - to_json() serialisiert timestamp/bytes JSON-sicher (default=json_default). Tests: tests/test_dtypes.py (Registry, alle dtypes lenient+strict, Re-Cast, Bug-Regressionen, JSON-Roundtrip). Bestehende metadata/attribute/base-Tests laufen unverändert grün. Coverage 100%.
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| Documentation | 6 minor |
| Security | 50 high |
🟢 Metrics 86 complexity · 0 duplication
Metric Results Complexity 86 Duplication 0
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Erster PR des Metadaten-Rückgrat-Programms (Scope: Robustheit + Maschinenlesbarkeit, PR1–PR4). Robustheit & Korrektheit — strikt additiv, lenient-Verhalten byte-genau erhalten.
Neu:
sdata/dtypes.py(pure stdlib)Single Source of Truth für Coercion, JSON-(De)Serialisierung, Python-Klasse und XSD-Typ-Mapping (Grundlage der JSON-LD-Schicht in PR2/PR3).
Verbesserungen
TimeStamp, ISO-8601/UTC) — war bisher kaputt.strict=Truecase-insensitiv (yes/no/on/off…), wirft bei Mehrdeutigkeit.resolve); dtype-Wechsel castet den Wert um (bisheriger TODO).bytes(base64),json(dict/list),uri(+ XSDbase64Binary/anyURI).strict=wirftDtypeErrorstatt still zu degradieren.Bugfixes
Metadata.name↔_sdata_nameals Single Source of Truth (keine Desync).relabel()schlüsselt explizit um (kein Präfix-Verlust).update_hash()gibt das Hash-Objekt zurück (statt der builtin-hash-Klasse).to_json()serialisiert timestamp/bytes JSON-sicher.Kompatibilität & Tests
Keine neuen Dependencies.
Attribute/Metadata-Public-API unverändert;base.pyunberührt. Die bestehendentest_metadata*/test_attribute/test_base*-Tests laufen unverändert grün. Neu:tests/test_dtypes.py. 418 passed, 8 skipped, Coverage 100 %.