The Wayback Machine - https://web.archive.org/web/20210921073806/https://github.com/topics/dataclasses
Skip to content
#

dataclasses

Here are 90 public repositories matching this topic...

notion-sdk-py
s-knibbs
s-knibbs commented Jun 30, 2019

It seems that the typing module doesn't flatten nested literal type definitions, so the following does not currently work:

SuccessStatus = Literal[200, 201, 204]
ClientError = Literal[404, 401, 403, 409, 400]
ServerError = Literal[500, 504, 503]

@dataclass
class HttpResponse(JsonSchemaMixin):
    status: Literal[SuccessStatus, ClientError, ServerError]
    ...
SimpleParsing
Ozziko
Ozziko commented Jul 23, 2021

simple-parsing is simply awesome (thanks!). I'd like to suggest a feature that is crucial for parsing nested args, in my opinion, and the support of other researchers in my group. Here is a minimal example to make things clear:

from dataclasses import dataclass
from simple_parsing import ArgumentParser, ConflictResolution

@dataclass
class WandbArgs:
    dir: str = ''  # Wandb run ca

Improve this page

Add a description, image, and links to the dataclasses topic page so that developers can more easily learn about it.

Curate this topic

Add this topic to your repo

To associate your repository with the dataclasses topic, visit your repo's landing page and select "manage topics."

Learn more