Skip to content
#

dataclasses

Here are 105 public repositories matching this topic...

notion-sdk-py
corranwebster
corranwebster commented Sep 30, 2020

It is common to have Union traits of the form Union(None, <something>). As a convenience to developers, and following a similar convention in Python's typing module, we should consider having Optional(<something>) as an alternative way of writing Union(None, <something>).

An alternative would be to make allow_none metadata universally accepted across TraitType instances.

SimpleParsing
nacitar
nacitar commented Oct 23, 2021

Describe the bug
When help text is added to a field that does not have a default value, the help text indicates a default value of None when it should not.

To Reproduce

#!/usr/bin/env python3
# test_simple.py
from dataclasses import dataclass
from simple_parsing import ArgumentParser

@dataclass
class Options:
    list_items: list[str]  # SOMETHING

parser = Argume
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]
    ...

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