# Path: importer/importer/utils/parsing.py

# 
# Path: importer/importer/utils/collections.py
# def find_first(needles, haystack):
#     for needle in needles:
#         if needle in haystack:
#             return needle
# 
# Path: importer/importer/utils/strings.py
# def strip_links(text):
#     return link_expression.sub('\\1', text)
# 
# def find_numbers(text):
#     return [
#         int(''.join(filter(str.isdigit, s)))
#         for s in number_expression.findall(text)
#         if s.strip()
#     ]
# 
# def is_from_string(text):
#     return bool(from_expression.match(text))
# 
# def is_up_to_string(text):
#     return bool(up_to_expression.match(text))


from operator import itemgetter
from funcy import flatten, project, first
from datetime import datetime, time, timedelta
from isodate import parse_date
from .utils.parsing import maybe_parse_date, maybe_parse_time
from .utils.collections import find_first
from .utils.strings import (
    strip_links,
    find_numbers,
    is_from_string,
    is_up_to_string,
)
        )
        start = datetime.combine(start_date, start_time)
        end = datetime.combine(end_date, end_time)
        if overflows_into_next_day:
            end += timedelta(days=1)

    if is_date_based:
        return {
            'start': start.date().isoformat(),
            'end': end.date().isoformat(),
        }
    else:
        return {
            'start': start.isoformat(),
            'end': end.isoformat(),
        }


def split_date(spec):
    if spec['is_continuous']:
        yield project(spec, (
            'is_continuous',
            'start_date',
            'end_date',
            'start_time',
            'end_time',
        ))
        return

    start_date = parse_date(spec['start_date'])

# Path: importer/importer/utils/parsing.py

# 
# Path: importer/importer/utils/collections.py
# def find_first(needles, haystack):
#     for needle in needles:
#         if needle in haystack:
#             return needle
# 
# Path: importer/importer/utils/strings.py
# def strip_links(text):
#     return link_expression.sub('\\1', text)
# 
# def find_numbers(text):
#     return [
#         int(''.join(filter(str.isdigit, s)))
#         for s in number_expression.findall(text)
#         if s.strip()
#     ]
# 
# def is_from_string(text):
#     return bool(from_expression.match(text))
# 
# def is_up_to_string(text):
#     return bool(up_to_expression.match(text))


# Path: importer/importer/transform.py
from operator import itemgetter
from funcy import flatten, project, first
from datetime import datetime, time, timedelta
from isodate import parse_date
from .utils.parsing import maybe_parse_date, maybe_parse_time
from .utils.collections import find_first
from .utils.strings import (
    strip_links,
    find_numbers,
    is_from_string,
    is_up_to_string,
)

        )
        start = datetime.combine(start_date, start_time)
        end = datetime.combine(end_date, end_time)
        if overflows_into_next_day:
            end += timedelta(days=1)

    if is_date_based:
        return {
            'start': start.date().isoformat(),
            'end': end.date().isoformat(),
        }
    else:
        return {
            'start': start.isoformat(),
            'end': end.isoformat(),
        }


def split_date(spec):
    if spec['is_continuous']:
        yield project(spec, (
            'is_continuous',
            'start_date',
            'end_date',
            'start_time',
            'end_time',
        ))
        return

    start_date = parse_date(spec['start_date'])

    end_date = maybe_parse_date(spec['end_date']) or start_date