dominicprice / endplay

A suite of tools for generation and analysis of bridge deals. Read the documentation at https://endplay.readthedocs.io
MIT License
22 stars 5 forks source link

generate_deal() specifying predeal throws AttributeError #9

Closed BSalita closed 2 years ago

BSalita commented 2 years ago

I'm trying to use endplay.dealer.generate_deal(() with constraints and predeal args. I'm unable to use predeal in any form because it raises an AttributeError exception.

import endplay

constraints = "hcp(north) > 10"
predeal = endplay.types.deal.Deal()

d = endplay.dealer.generate_deal(constraints, predeal) # AttributeError: 'Deal' object has no attribute 'dtype'
dominicprice commented 2 years ago

You need to specify the predeal as a keyword argument, try

endplay.dealer.generate_deal(constraints, predeal=predeal)

and it should work. The first argument to generate_deal is an *args style parameter so it will swallow up any arguments which aren't named and assume they are meant to be constraints.

BSalita commented 2 years ago

Yea, that's undoubtedly the solution.