Skip to content

Instantly share code, notes, and snippets.

@inesp
Created September 2, 2019 13:27
Show Gist options
  • Save inesp/db8fe7e0d9268269d65fe9748b1db944 to your computer and use it in GitHub Desktop.
Save inesp/db8fe7e0d9268269d65fe9748b1db944 to your computer and use it in GitHub Desktop.
class ZOOsConfigBuilder:
def _build_paris_config(animal_types):
def _get_config(owner: str, zoo_size: int) -> ZooOutline:
animals: List[Animal] = create_animals(animal_types)
return ZooOutline(
# I also had to rename owner to owner_name and
# because I am now instantiating a class
# PyCharm automatically underlines the old
# `owner` key name until I change it to
# `owner_name`
owner_name=owner,
size=zoo_size,
animals=animals.values(),
most_popular_animal=get_favorite_animal(...),
)
return _get_config
def _build_vienna_config(animal_types: List[str]):
def _get_config(owner: str, zoo_size: int) -> ZooOutline:
animals: List[Animal] = create_animals(animal_types):
return ZooOutline(
owne_namer=owner,
size=zoo_size,
animals=animals,
free_entrance_day=WeekDay.FRI,
)
return _get_config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment