Cleanup: remove tiny 'canteen' module, document main entry points

This commit is contained in:
Falco Duersch
2018-09-26 16:14:35 +02:00
committed by f4lco
parent 8edc5a0ced
commit 221d1ab964
4 changed files with 28 additions and 8 deletions
+9 -1
View File
@@ -3,8 +3,12 @@
import ConfigParser
import io
import os
from collections import namedtuple
from functools import partial
from stw_potsdam.canteen import Canteen
Canteen = namedtuple('Canteen',
('key', 'name', 'street', 'city', 'id', 'chash'))
def _get_config(filename):
@@ -26,5 +30,9 @@ def _parse_canteen(config, canteen_name):
def read_canteen_config():
"""Read the configured canteens from file.
:return: dictionary which maps from canteen short name to :class:`Canteen`.
"""
config = _get_config('canteens.ini')
return {name: _parse_canteen(config, name) for name in config.sections()}