rezemika / humanized_opening_hours

A parser for the opening_hours fields from OpenStreetMap
GNU Affero General Public License v3.0
26 stars 20 forks source link

Ajouter une méthode pour récupérer un objet HOHRenderer #1

Closed rezemika closed 6 years ago

rezemika commented 6 years ago

Pour l'instant, pour pouvoir faire un rendu, il faut faire tout ça.

import humanized_opening_hours
field = "Mo-Fr 06:00-21:00; Sa,Su 07:00-21:00"
hoh = humanized_opening_hours.HumanizedOpeningHours(field)
hohr = humanized_opening_hours.HOHRenderer(hoh)
print(hohr.description())

Il faudrait ajouter une méthode à HumanizedOpeningHours pour récupérer un objet hohr prêt à être utilisé, pour pouvoir faire quelque chose comme ça.

import humanized_opening_hours
field = "Mo-Fr 06:00-21:00; Sa,Su 07:00-21:00"
hoh = humanized_opening_hours.HumanizedOpeningHours(field)
print(hoh.render().description())