Skip to content

Commit

Permalink
Feature/more endpoint support (#92)
Browse files Browse the repository at this point in the history
* chaser - 1st endpoint should already work

* initial pass at 2nd end point

* initial pass at endpoint #3 - a small but incompatible refactoring

* chaser - manual debugging

* more 3rd endpoint work

* more 3rd endpoint debugging; better cast syntax checking

* sorting pyproject

* manual debugging post initial web-api integration thoughts

* chaser - decided to switch the constructor to keywords

* mv test to tests to match other repos

* chaser - get_guid_dir bugfix
  • Loading branch information
windoverwater authored Apr 7, 2023
1 parent 81346d8 commit b97d633
Show file tree
Hide file tree
Showing 32 changed files with 712 additions and 372 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# Variables
DOC_DIR := docs
SRC_DIR := src/vtp
TEST_DIR := test
TEST_DIR := tests
BUILD_DIR := _tools/build
BUILD_FILES := pyproject.toml poetry.lock setup.cfg

Expand Down
234 changes: 134 additions & 100 deletions _tools/build/poetry_poetry.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion _tools/build/poetry_pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ packages = [
]

[tool.poetry.dependencies]
deepdiff = "^6.3.0"
networkx = "^2.8.6"
pyinputplus = "^0.2.12"
python = "^3.9"
Expand All @@ -23,8 +24,8 @@ pyyaml = "^6.0"
[tool.poetry.group.dev.dependencies]
black = "^23.1.0"
isort = "^5.12.0"
pylint = "^2.16.2"
mypy = "^1.1.1"
pylint = "^2.16.2"
pytest = "^7.2.1"
pytest-cov = "^4.0.0"
sphinx = "^5.3.0"
Expand Down
198 changes: 102 additions & 96 deletions requirements.txt

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions src/vtp/cli/accept_ballot.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,16 @@ def main():

# Convert the address args into an Address
an_address = Address(
address=parsed_args.address,
substreet=parsed_args.substreet,
town=parsed_args.town,
state=parsed_args.state,
generic_address=True,
)

# do it
abo = AcceptBallotOperation(
parsed_args.election_data_dir, parsed_args.verbosity, parsed_args.printonly
election_data_dir=parsed_args.election_data_dir,
verbosity=parsed_args.verbosity,
printonly=parsed_args.printonly,
)
abo.run(
an_address=an_address,
Expand Down
14 changes: 12 additions & 2 deletions src/vtp/cli/cast_ballot.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ def parse_arguments():
action="store_true",
help="set demo mode to automatically cast random ballots",
)
parser.add_argument(
"-r",
"--return_blank_ballot",
action="store_true",
help="Will return the blank JSON ballot",
)
Arguments.add_blank_ballot(parser)
Arguments.add_verbosity(parser)
Arguments.add_printonly(parser)
Expand All @@ -88,13 +94,17 @@ def main():

# do it
cbo = CastBallotOperation(
parsed_args.election_data_dir, parsed_args.verbosity, parsed_args.printonly
election_data_dir=parsed_args.election_data_dir,
verbosity=parsed_args.verbosity,
printonly=parsed_args.printonly,
)
cbo.run(
return_string = cbo.run(
an_address=an_address,
blank_ballot=parsed_args.blank_ballot,
demo_mode=parsed_args.demo_mode,
return_bb=parsed_args.return_blank_ballot,
)
print(return_string)


# If called directly via this file
Expand Down
4 changes: 3 additions & 1 deletion src/vtp/cli/create_blank_ballot.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ def main():

# do it
cbbo = CreateBlankBallotOperation(
parsed_args.election_data_dir, parsed_args.verbosity, parsed_args.printonly
election_data_dir=parsed_args.election_data_dir,
verbosity=parsed_args.verbosity,
printonly=parsed_args.printonly,
)
cbbo.run(
an_address=an_address,
Expand Down
4 changes: 3 additions & 1 deletion src/vtp/cli/generate_all_blank_ballots.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ def main():

# do it
gabbo = GenerateAllBlankBallotsOperation(
parsed_args.election_data_dir, parsed_args.verbosity, parsed_args.printonly
election_data_dir=parsed_args.election_data_dir,
verbosity=parsed_args.verbosity,
printonly=parsed_args.printonly,
)
gabbo.run()

Expand Down
4 changes: 3 additions & 1 deletion src/vtp/cli/merge_contests.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ def main():

# do it
mco = MergeContestsOperation(
parsed_args.election_data_dir, parsed_args.verbosity, parsed_args.printonly
election_data_dir=parsed_args.election_data_dir,
verbosity=parsed_args.verbosity,
printonly=parsed_args.printonly,
)
mco.run(
branch=parsed_args.branch,
Expand Down
4 changes: 3 additions & 1 deletion src/vtp/cli/run_mock_election.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ def main():

# do it
rmeo = RunMockElectionOperation(
parsed_args.election_data_dir, parsed_args.verbosity, parsed_args.printonly
election_data_dir=parsed_args.election_data_dir,
verbosity=parsed_args.verbosity,
printonly=parsed_args.printonly,
)
rmeo.run(
an_address=an_address,
Expand Down
6 changes: 3 additions & 3 deletions src/vtp/cli/setup_vtp_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ def main():

# do it
svdo = SetupVtpDemoOperation(
parsed_args.election_data_dir,
parsed_args.verbosity,
parsed_args.printonly,
election_data_dir=parsed_args.election_data_dir,
verbosity=parsed_args.verbosity,
printonly=parsed_args.printonly,
)
guid = svdo.run(
scanners=parsed_args.scanners,
Expand Down
4 changes: 3 additions & 1 deletion src/vtp/cli/show_contest.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ def main():

# do it
sco = ShowContestsOperation(
parsed_args.election_data_dir, parsed_args.verbosity, parsed_args.printonly
election_data_dir=parsed_args.election_data_dir,
verbosity=parsed_args.verbosity,
printonly=parsed_args.printonly,
)
sco.run(
contest_check=parsed_args.contest_check,
Expand Down
6 changes: 3 additions & 3 deletions src/vtp/cli/tally_contests.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ def main():

# do it
tco = TallyContestsOperation(
parsed_args.election_data_dir,
parsed_args.verbosity,
False,
election_data_dir=parsed_args.election_data_dir,
verbosity=parsed_args.verbosity,
printonly=False,
)
tco.run(
contest_uid=parsed_args.contest_uid,
Expand Down
6 changes: 3 additions & 3 deletions src/vtp/cli/verify_ballot_receipt.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ def main():

# do it
vbro = VerifyBallotReceiptOperation(
parsed_args.election_data_dir,
parsed_args.verbosity,
False,
election_data_dir=parsed_args.election_data_dir,
verbosity=parsed_args.verbosity,
printonly=False,
)
vbro.run(
receipt_file=parsed_args.receipt_file,
Expand Down
4 changes: 3 additions & 1 deletion src/vtp/cli/vote.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ def main():

# do it
vote_op = VoteOperation(
parsed_args.election_data_dir, parsed_args.verbosity, parsed_args.printonly
election_data_dir=parsed_args.election_data_dir,
verbosity=parsed_args.verbosity,
printonly=parsed_args.printonly,
)
vote_op.run(
an_address=an_address,
Expand Down
Loading

0 comments on commit b97d633

Please sign in to comment.