Skip to content

Commit

Permalink
Refactor config parsing and validation w/ pydantic
Browse files Browse the repository at this point in the history
  • Loading branch information
oedokumaci committed Feb 17, 2023
1 parent 48d4f7c commit fbf38a0
Show file tree
Hide file tree
Showing 8 changed files with 140 additions and 201 deletions.
7 changes: 4 additions & 3 deletions config/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
proposer_and_responder: [man, woman]
preference_type: random
proposer_side_name: man
responder_side_name: woman
number_of_proposers: 12
number_of_responders: 12
log_file: logs.log
preference_type: random
log_file_name: logs.log
11 changes: 6 additions & 5 deletions config/example_config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
proposer_and_responder: [woman, man] # first entry is proposer, second is responder
preference_type: random # random for now, input will be implemented later
number_of_proposers: 5 # number of proposers, not necessarily equal to number of responders
number_of_responders: 7 # number of responders, not necessarily equal to number of proposers
log_file: logs.log # log file name, will be saved in logs folder
proposer_side_name: man
responder_side_name: woman
number_of_proposers: 5
number_of_responders: 7
preference_type: random # only random is valid for now, custom input will be implemented later
log_file: logs.log # will be saved in logs folder
59 changes: 58 additions & 1 deletion pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ authors = [
]
dependencies = [
"pyyaml>=6.0",
"pydantic>=1.10.5",
]
requires-python = ">=3.9"
readme = "README.md"
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pdm==2.4.5
platformdirs==2.5.2
pluggy==1.0.0
pre-commit==3.0.4
pydantic==1.10.5
pygments==2.14.0
pyproject-hooks==1.0.0
pytest==7.2.1
Expand All @@ -35,6 +36,7 @@ setuptools==65.5.0
shellingham==1.5.0.post1
tomli==2.0.1
tomlkit==0.11.6
typing-extensions==4.5.0
unearth==0.7.2
urllib3==1.26.14
virtualenv==20.16.6
4 changes: 2 additions & 2 deletions src/gale_shapley/cli.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"""Command line application module for Gale-Shapley algorithm."""

from gale_shapley.config_parser import parsed_config
from gale_shapley.config_parser import config_input
from gale_shapley.simulator import Simulator


def main() -> int:
"""Main function for Gale-Shapley algorithm."""
sim = Simulator(*parsed_config)
sim = Simulator(config_input)
sim.number_of_simulations = 1000 # TODO: Make this configurable
sim.simulate()
return 0
Expand Down
Loading

0 comments on commit fbf38a0

Please sign in to comment.