event.utils.guidle

Module Contents

Classes

GuidleBase

Base class for parsing guidle exports containing general helpers.

GuidleExportData

Represents a whole guidle export.

GuidleOffer

Represents a single offer containing some description and dates.

GuidleScheduleDate

Represents a single schedule date of an offer.

Attributes

_T

event.utils.guidle._T[source]
class event.utils.guidle.GuidleBase(root: lxml.etree._Element)[source]

Base class for parsing guidle exports containing general helpers.

find(path: str, root: _Element | None = None) list[lxml.etree._Element][source]

Gets the elements with the given path.

get(path: str, root: _Element | None = None, joiner: str = ' ', parser: None = None) str[source]
get(path: str, root: _Element | None = None, joiner: str = ' ', *, parser: Callable[[str], _T]) _T | None

Returns the text of the elements with the given path.

Allows to specifiy a joining character and optionally a parser. If no parser is given, the text is HTML-cleaned.

join(texts: Sequence[str], joiner: str = ', ') str[source]

Joins a set of text, skips duplicate and empty texts while preserving the order.

class event.utils.guidle.GuidleExportData(root: lxml.etree._Element)[source]

Bases: GuidleBase

Represents a whole guidle export.

offers() Iterator[GuidleOffer][source]
class event.utils.guidle.GuidleOffer(root: lxml.etree._Element)[source]

Bases: GuidleBase

Represents a single offer containing some description and dates.

uid() str | None[source]
last_update() str[source]
title() str[source]
description() str[source]
price() str[source]
organizer() str[source]
organizer_email() str[source]
location() str[source]
image(size: str) tuple[str, str] | tuple[None, None][source]

Returns the image url for the offer with the given size, together with the filename, or (None, None).

pdf() tuple[str, str] | tuple[None, None][source]

Returns the first attachment that is a pdf, together with the filename, or (None, None).

tags(tagmap: Mapping[str, str] | None = None) tuple[set[str], set[str]][source]

Returns a set of known and a set of unkonwn tags.

coordinates() onegov.gis.Coordinates | None[source]
schedules() Iterator[GuidleScheduleDate][source]
class event.utils.guidle.GuidleScheduleDate(root: lxml.etree._Element)[source]

Bases: GuidleBase

Represents a single schedule date of an offer.

timezone() str[source]