Added BOS equal shares and fractional equal shares with tests#69
Added BOS equal shares and fractional equal shares with tests#69IvanGorbache wants to merge 14 commits into
Conversation
|
|
||
| return dict(sorted(project_part.items(), key=lambda item: str(item[0]))) | ||
|
|
||
|
|
There was a problem hiding this comment.
Can you remove the main please. It's not needed in the package.
| return voter.utility(project) | ||
| return 1 if project in voter else 0 | ||
|
|
||
|
|
There was a problem hiding this comment.
Can you please type all the functions as done in the other files of the package.
There was a problem hiding this comment.
This needs to be uniform with the rest of the package.
Simon-Rey
left a comment
There was a problem hiding this comment.
Thanks for your submission, I have added important comments to uniform your work with the rest of the package
|
I will add the needed changes as soon as possible |
- moved files to correct directories - add checks for profile and ballot types - change pytest to unitest - added parameters and return to the function description
|
I have made the needed changes |
Simon-Rey
left a comment
There was a problem hiding this comment.
Almost there, you still need to:
- Type the functions as done elsewhere in the package
- Update the docstring of the functions to match the package convention.
| """ | ||
| if not isinstance(profile, (ApprovalProfile, CardinalProfile)): | ||
| raise TypeError("profile must be an instance of ApprovalProfile or CardinalProfile") | ||
| if any(not isinstance(voter, (ApprovalBallot, CardinalBallot)) for voter in profile): |
There was a problem hiding this comment.
This is not needed, it costs time to do that, let's just assume that if the right profile is passed, the ballot type is correct ;)
| return voter.utility(project) | ||
| return 1 if project in voter else 0 | ||
|
|
||
|
|
There was a problem hiding this comment.
This needs to be uniform with the rest of the package.
|
As an example, here is the typing and docstring for MES: |
updated the functions and tests to be in line with the rest of the package
Hello,
I have created a fork that adds two new methods for budgeting, BOS equal shares and fractional equal shares, as well as tests for the new methods. Their implementation is based on the pseudocode outlined in the attached article
bos_equal_shares.py
test_rule.py
50.pdf
Thank you in advance!