feat(dtypes): complex- und floatlist-dtypes (typisierte Float-Liste)#84
Merged
Conversation
Zwei weitere Attribut-dtypes, strikt additiv:
- complex -> complex (sdata:complex) "1+2j"/"(1+2j)"/Zahl; bool abgelehnt
- floatlist -> list[float] (sdata:floatlist) aus CSV-String, list/tuple oder
numpy-Array (.tolist); Alias dtype="list[float]"/"float[]"
Beide haben keinen Standard-XSD-Typ -> eigene Datentyp-CURIEs (sdata:complex /
sdata:floatlist), damit der JSON-LD-Round-Trip verlustfrei bleibt:
- semantic._DTYPE_FROM_XSD: sdata:complex -> complex
- semantic._set_from_node: list mit @type sdata:floatlist -> floatlist (statt str-list)
Anbindung: DTYPES_INV (complex), json_default (complex -> str), DtypeSpec.to_json
(complex -> "(1+2j)"; floatlist JSON-nativ), resolve-Alias list[float]. floatlist-
Leer-Check skalar-sicher (kein elementweiser numpy-Vergleich).
Tests: Coercion (gueltig/leer/ungueltig/strict, numpy-Array, bool abgelehnt), to_json,
json_default, resolve/Alias, xsd-Map, JSON- und JSON-LD-Round-Trip (floatlist bleibt
floatlist, nicht str-list). dtypes.py 275/275 100%, semantic.py 100%.
Doku + CHANGELOG [1.3.0] ergaenzt.
Kanonische CI: 616 passed, 7 skipped, TOTAL 100%; mkdocs --strict gruen.
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| CodeStyle | 1 minor |
| Complexity | 1 medium |
🟢 Metrics 29 complexity · 0 duplication
Metric Results Complexity 29 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.
Was
Zwei weitere Attribut-dtypes (reine stdlib + numpy-Core), strikt additiv:
complexcomplexsdata:complex"1+2j"/"(1+2j)"/Zahl;boolabgelehntfloatlistlist[float]sdata:floatlistlist/tupleoder numpy-Array (.tolist)floatlistakzeptiert auch das Aliasdtype="list[float]"(und"float[]").Verlustfreier JSON-LD-Round-Trip
Beide haben keinen Standard-XSD-Typ → eigene Datentyp-CURIEs:
semantic._DTYPE_FROM_XSD:sdata:complex→complexsemantic._set_from_node: eine Liste mit@type sdata:floatlist→floatlist(statt der generischen str-
list)Anbindung
DTYPES_INV(complex),json_default(complex→str),DtypeSpec.to_json(
complex→"(1+2j)";floatlistJSON-nativ),resolve-Aliaslist[float].Der
floatlist-Leer-Check ist skalar-sicher (kein elementweiser numpy-Vergleich).Tests / CI
tests/test_dtypes.py: Coercion (gültig/leer/ungültig/strict, numpy-Array,boolabgelehnt),
to_json,json_default,resolve/Alias, XSD-Map, JSON- undJSON-LD-Round-Trip (floatlist bleibt floatlist, nicht str-list).
dtypes.py275/275 100 %,semantic.py100 %.Kanonische CI: 616 passed, 7 skipped, TOTAL 100 %;
mkdocs build --strictgrün.ns/context.jsonld-Sync-Guard unberührt. Doku + CHANGELOG [1.3.0] ergänzt.