Support for Literal?
See original GitHub issueI’d like to be able to deserialize from_dict() a Union of overlapping types based on the Literal values. Is that possible?
@dataclass
class AType:
# changing type to str doesn't help
type: Literal['A'] = 'A'
@dataclass
class BType:
type: Literal['B'] = 'B'
@dataclass
class AorB:
u: Union[AType, BType]
obj = dacite.from_dict(
data_class=AorB,
data=loaded_dict,
config=dacite.Config(strict=False)
)
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (3 by maintainers)
Top Results From Across the Web
Literal Support Definition - patents - Law Stack Exchange
Literal support means that the words of the claim are identical to words in the description. It does not have any particular nuanced...
Read more >ES6 Template Literals (Template Strings) - CanIUse
Template literals are string literals allowing embedded expressions using backtick characters (`). You can use multi-line strings and string interpolation ...
Read more >Template literals (Template strings) - JavaScript | MDN
Template literals are literals delimited with backtick ( ` ) characters, allowing for multi-line strings, string interpolation with embedded ...
Read more >Add support for literal-string type, to address Injection ... - GitHub
To help with adoption, literal-string values can be concatenated. This is often used by developers today, and because no user input is included, ......
Read more >ARM Compiler v5.06 for uVision armcc User Guide
Compiler support for literal pools. Literal pools are areas of constant data in a code section. No single instruction can generate a 4...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Gideon-Felt in the meantime you can use this in your requirements.txt file:
git+https://github.com/Pickle-Robot/dacite/@master#egg=dacite
We are still stuck on 3.7.6 as well and this works for us.
@jbcpollak Deployed to PyPI 🎉