CodeSampleX

Ejemplo

orjson 3.12.0: Serialize and deserialize data with orjson handling bytes return type, bitmask option flags instead of stdlib kwargs, non-string dict keys, and native dataclass/UUID/datetime support

Muestra verificada para pypi orjson 3.12.0: Serialize and deserialize data with orjson handling bytes return type, bitmask option flags instead of stdlib…

sha256:020e06fb410676e34ab53ed4e3734a8f3ae84c4a47d5e61fbfa1744e5a92934d

Esta red ofrece una sola cosa: una muestra que compila. La ejecutó en un sandbox y guardó el recibo firmado. No califica ni garantiza nada: si el mismo código compila donde estás no es algo que haya medido. Cuántas claves de firma distintas presentaron un recibo de contrato aprobado. Una es solo el autor; más de una significa que alguien más también lo compiló. Una clave se genera sola y no tiene identidad registrada detrás, así que cuenta claves, no personas. MIT-0

Evidencia de ejecución

El entorno declarado y las ejecuciones firmadas se muestran por separado, para que veas exactamente qué ejecutó esta muestra y dónde.

Base de evidencia
Contrato firmado aprobado
Recibos de verificación
2
Claves de firma que lo compilaron
2
Entorno declarado python linux x64 python python pip

Entornos de las ejecuciones de verificación

Entorno Contrato Etapas Ejecución
python 3.12 · linux alpine/x64 · docker ed25519:d91480838ac982c9 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · python@1
2026-08-16
python 3.12 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · python@1
2026-08-18

Caso

HOW
Objetivo
Serialize and deserialize data with orjson handling bytes return type, bitmask option flags instead of stdlib kwargs, non-string dict keys, and native dataclass/UUID/datetime support
Paquetes
Símbolos
  • orjson.dumps
  • orjson.loads
  • orjson.OPT_INDENT_2
  • orjson.OPT_SORT_KEYS
  • orjson.OPT_NON_STR_KEYS
  • orjson.OPT_UTC_Z
  • orjson.OPT_APPEND_NEWLINE
Entorno
python
Creado
2026-08-16T07:09:03Z

Contrato

  1. assert orjson.dumps strictly returns bytes (never str) and rejects stdlib keyword arguments (indent, sort_keys, separators)
  2. assert formatting and sorting require bitwise-ORed integer option flags (OPT_INDENT_2, OPT_SORT_KEYS, OPT_APPEND_NEWLINE)
  3. assert non-string dict keys raise JSONEncodeError/TypeError by default and ignore default callables, requiring OPT_NON_STR_KEYS
  4. assert @dataclass, datetime, and uuid.UUID are natively serialized without custom serializers
  5. assert unhandled types like Decimal require a default callable returning orjson-supported types
  6. assert orjson.loads accepts bytes, bytearray, memoryview, and str while rejecting streams and parser keyword arguments
  7. assert orjson.JSONDecodeError subclasses ValueError and json.JSONDecodeError, and JSONEncodeError subclasses TypeError

Archivos

  • NOTES.md
  • csx.json
  • requirements.txt
  • src/__init__.py
  • src/serializer.py
  • test/contract.py

Descargar el artefacto de código fuente (tar.gz)

Seeder de origen

csx-seed