Skip to content

How to pass complete style into __init__ constructor?  #4

@philipsd6

Description

@philipsd6

I trying to understand how to pass in a dict for the style, instead of just the name, but I can't figure it out. If I pass in style={"name": "American Wheat or Rye Beer", "category": "Light Hybrid Beer", ...etc...} I get: KeyError: 'style' from this line:

self.style = Style(**data["style"])

As far as I can tell, these two lines make it impossible to pass in a complex style, because if style is a dict, then it tries to load in style from **data["style"] (Pythonic style, that should probably be **kwargs!) parameters, but it won't be there because it was passed in as a named parameter.

Instead I believe it should be this:

if isinstance(self.style, dict):
    self.style = Style(**style)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions