MCPcopy Create free account
hub / github.com/bslatkin/effectivepython / do_rounds

Function do_rounds

example_code/item_111.py:152–163  ·  view source on GitHub ↗
(database, species)

Source from the content-addressed store, hash-verified

150 pass
151
152def do_rounds(database, species):
153 now = datetime.now()
154 feeding_timedelta = get_food_period(database, species)
155 animals = get_animals(database, species)
156 fed = 0
157
158 for name, last_mealtime in animals:
159 if (now - last_mealtime) > feeding_timedelta:
160 feed_animal(database, name, now)
161 fed += 1
162
163 return fed
164
165
166print("Example 11")

Callers 1

item_111.pyFile · 0.70

Calls 4

get_food_periodFunction · 0.85
get_animalsFunction · 0.85
feed_animalFunction · 0.85
get_do_rounds_timeFunction · 0.85

Tested by

no test coverage detected