Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parser API enhancements #7

Closed
ghing opened this issue Nov 14, 2014 · 0 comments
Closed

Parser API enhancements #7

ghing opened this issue Nov 14, 2014 · 0 comments
Assignees

Comments

@ghing
Copy link
Contributor

ghing commented Nov 14, 2014

Add support for looking up contests by text:

parser = Parser()
parser.parse(f)
contest = parser.get_contest("U.S. President - DEM").

Add support for looking up precincts by name.

parser = Parser()
parser.parse(f)
precinct = parser.get_jurisdiction("03 Bradley")

Add support for getting all results for a jurisdiction.

parser = Parser()
parser.parse(f)
precinct = parser.get_jurisdiction("03 Bradley")
results = precinct.results
@ghing ghing self-assigned this Nov 14, 2014
ghing added a commit that referenced this issue Nov 14, 2014
Add ``Parser.get_contest`` method to look up contests by text.

Add ``Parser.get_result_jurisdiction`` method to look up
sub-jurisdictions by name.

DRY-up creation of results for sub-jurisdictions.

Create a mixin classs, ``ResultAggregatorMixin`` for other classes that
have related results.  This removes repeated definitions of ``results``
and ``add_result`` methods.

Mix that class into ``ResultJurisdiction`` so that instances can have
associated results.

Update the constructor of ``Result`` to add the newly created instance
to its associated jurisdiction, if present, when a new ``Result`` is
instantiated.

Addresses #7
ghing added a commit that referenced this issue Nov 20, 2014
Show access to individual object properties.

Add examples showing some of the API methods that implement #7.

Make the examples flow together a bit more.
@ghing ghing closed this as completed Nov 20, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant