activity.utils

Attributes

SupportsRichComparisonT

INTERNAL_IMAGE_EX

NUM_RANGE_RE

DATE_RANGE_RE

MUNICIPALITY_EX

GROUP_CODE_EX

Functions

random_group_code(→ str)

is_valid_group_code(→ bool)

overlaps(→ bool)

merge_ranges(→ list[RangeTuple[SupportsRichComparisonT]])

Merges the given list of ranges into a list of ranges including only

num_range_decode(→ tuple[int, int] | None)

num_range_encode(→ str)

date_range_decode(→ tuple[datetime.date, ...)

date_range_encode(→ str)

generate_xml(→ str)

Creates an xml for import through ISO20022. Used for testing only.

dates_overlap(→ bool)

Returns true if any time tuple in the list of tuples in a overlaps

is_internal_image(→ TypeGuard[str])

extract_thumbnail(→ str | None)

extract_municipality(→ tuple[int, str] | None)

Module Contents

activity.utils.SupportsRichComparisonT[source]
activity.utils.INTERNAL_IMAGE_EX[source]
activity.utils.NUM_RANGE_RE[source]
activity.utils.DATE_RANGE_RE[source]
activity.utils.MUNICIPALITY_EX[source]
activity.utils.GROUP_CODE_EX[source]
activity.utils.random_group_code() str[source]
activity.utils.is_valid_group_code(code: str) bool[source]
activity.utils.overlaps(range_a: RangeLike[SupportsRichComparisonT], range_b: RangeLike[SupportsRichComparisonT]) bool[source]
activity.utils.merge_ranges(ranges: Iterable[RangeTuple[SupportsRichComparisonT]]) list[RangeTuple[SupportsRichComparisonT]][source]

Merges the given list of ranges into a list of ranges including only exclusive ranges. The ranges are turned into tuples to make them hashable.

activity.utils.num_range_decode(s: object) tuple[int, int] | None[source]
activity.utils.num_range_encode(a: RangeLike[int]) str[source]
activity.utils.date_range_decode(s: object) tuple[datetime.date, datetime.date] | None[source]
activity.utils.date_range_encode(d: RangeLike[date]) str[source]
activity.utils.generate_xml(payments: Iterable[dict[str, Any]]) str[source]

Creates an xml for import through ISO20022. Used for testing only.

activity.utils.dates_overlap(a: Iterable[RangeTuple[datetime]], b: Iterable[RangeTuple[datetime]], minutes_between: float = 0, cut_end: bool = True, alignment: Literal['day', 'week', 'month'] | None = None) bool[source]

Returns true if any time tuple in the list of tuples in a overlaps with a time tuple in b.

activity.utils.is_internal_image(url: str | None) TypeGuard[str][source]
activity.utils.extract_thumbnail(text: str | None) str | None[source]
activity.utils.extract_municipality(text: str | None) tuple[int, str] | None[source]