dryvPacks

@dryv/python-client-sdkv0.1.0

Async HTTPX client SDK with shared Pydantic models and typed operations.

Python Client SDKClientsUnitPublished 7 days ago2 downloads

dryv pack add @dryv/python-client-sdk
520 BRaw ↗
jinja
from enum import Enum
import json


{% macro py_json(text) -%}
{%- if text == 'true' -%}True
{%- elif text == 'false' -%}False
{%- elif text == 'null' -%}None
{%- else -%}{{ text }}
{%- endif -%}
{%- endmacro %}

class {{ file.symbol }}(Enum):
{% for item in property.enum.values %}
    {{ item.name.constant }} = {{ py_json(item.value_json) }}
{% endfor %}

    def __str__(self) -> str:
        if isinstance(self.value, str):
            return self.value
        return json.dumps(self.value, separators=(",", ":"))