# 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,
)



# main objects

def transform_event(kudago_event, parent_id, children_count):
    tags = kudago_event['tags']
    categories = kudago_event['categories']
    place = kudago_event['place']


# 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,
)




# main objects

def transform_event(kudago_event, parent_id, children_count):
    tags = kudago_event['tags']
    categories = kudago_event['categories']
    place = kudago_event['place']


    kind = find_first(('festival', 'exhibition', 'theater'), categories)