Skip to content

feat(dtypes): complex- und floatlist-dtypes (typisierte Float-Liste)#84

Merged
lepy merged 1 commit into
masterfrom
feat/dtypes-complex-floatlist
Jun 29, 2026
Merged

feat(dtypes): complex- und floatlist-dtypes (typisierte Float-Liste)#84
lepy merged 1 commit into
masterfrom
feat/dtypes-complex-floatlist

Conversation

@lepy

@lepy lepy commented Jun 29, 2026

Copy link
Copy Markdown
Owner

Was

Zwei weitere Attribut-dtypes (reine stdlib + numpy-Core), strikt additiv:

dtype Python CURIE Coercion
complex complex sdata:complex "1+2j"/"(1+2j)"/Zahl; bool abgelehnt
floatlist list[float] sdata:floatlist CSV-String, list/tuple oder numpy-Array (.tolist)

floatlist akzeptiert auch das Alias dtype="list[float]" (und "float[]").

Verlustfreier JSON-LD-Round-Trip

Beide haben keinen Standard-XSD-Typ → eigene Datentyp-CURIEs:

  • semantic._DTYPE_FROM_XSD: sdata:complexcomplex
  • semantic._set_from_node: eine Liste mit @type sdata:floatlistfloatlist
    (statt der generischen str-list)

Anbindung

DTYPES_INV (complex), json_default (complexstr), DtypeSpec.to_json
(complex"(1+2j)"; floatlist JSON-nativ), resolve-Alias list[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, 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 %.

Kanonische CI: 616 passed, 7 skipped, TOTAL 100 %; mkdocs build --strict grün.
ns/context.jsonld-Sync-Guard unberührt. Doku + CHANGELOG [1.3.0] ergänzt.

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.
@lepy lepy merged commit cfb3b5c into master Jun 29, 2026
1 of 2 checks passed
@lepy lepy deleted the feat/dtypes-complex-floatlist branch June 29, 2026 14:59
@codacy-production

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 1 medium · 1 minor

Alerts:
⚠ 2 issues (≤ 0 issues of at least minor severity)

Results:
2 new issues

Category Results
CodeStyle 1 minor
Complexity 1 medium

View in Codacy

🟢 Metrics 29 complexity · 0 duplication

Metric Results
Complexity 29
Duplication 0

View in Codacy

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant