# Path: fedocal/fedocallib/model.py
# BASE = declarative_base()
#     CONFIG = ConfigParser.ConfigParser()
# def create_tables(db_url, alembic_ini=None, debug=False):
# def drop_tables(db_url, engine):  # pragma: no cover
# def fill_default_status(session):
#     def __init__(self, status):
#     def __repr__(self):  # pragma: no cover
#     def all(cls, session):
#     def __init__(
#             self, calendar_name, calendar_contact, calendar_description,
#             calendar_editor_group=None, calendar_admin_group=None,
#             calendar_status='Enabled'):
#     def __repr__(self):
#     def to_json(self):
#     def save(self, session):
#     def delete(self, session):
#     def admin_groups(self):
#     def editor_groups(self):
#     def by_id(cls, session, identifier):
#     def get_editor_groups(cls, session, identifier):
#     def get_admin_groups(cls, session, identifier):
#     def get_all(cls, session):
#     def by_status(cls, session, status):
#     def __repr__(self):
#     def get_or_create(cls, session, username):
#     def create(cls, session, username):
#     def __repr__(self):
#     def get_or_create(cls, session, meeting, user):
#     def create(cls, session, meeting, user):
#     def __init__(
#             self, meeting_name,
#             meeting_date, meeting_date_end,
#             meeting_time_start, meeting_time_stop,
#             meeting_information, calendar_name, meeting_timezone='UTC',
#             reminder_id=None, meeting_location=None, recursion_frequency=None,
#             recursion_ends=None, full_day=False):
#     def __repr__(self):
#     def save(self, session):
#     def to_json(self):
#     def add_manager(self, session, meeting_manager):
#     def clear_managers(self, session):
#     def meeting_manager(self):
#     def delete(self, session):
#     def copy(self, meeting=None):
#     def by_id(cls, session, identifier):
#     def get_by_date(
#             cls, session, calendar, start_date, stop_date,
#             full_day=None, no_recursive=False,
#             name=None):
#     def get_by_date_and_location(
#             cls, session, calendar, start_date, stop_date, location):
#     def get_by_date_at_location(
#             cls, session, location, start_date, stop_date, full_day=None,
#             no_recursive=False):
#     def get_overlaping_meetings(
#             cls, session, calendar, start_date, stop_date):
#     def get_at_date(cls, session, calendar, meeting_date, full_day=None):
#     def get_active_regular_meeting(
#             cls, session, calendar, start_date, end_date, full_day=None):
#     def get_active_regular_meeting_at_location(
#             cls, session, location, start_date, end_date, full_day=None):
#     def get_regular_meeting_at_date(
#             cls, session, calendar, end_date, full_day=None):
#     def get_active_regular_meeting_by_date(
#             cls, session, calendar, start_date, full_day=None, name=None):
#     def get_active_regular_meeting_by_date_at_location(
#             cls, session, location, start_date, full_day=None):
#     def get_regular_meeting_by_date(
#             cls, session, calendar, start_date, end_date, full_day=None,
#             name=None):
#     def get_regular_meeting_by_date_at_location(
#             cls, session, location, start_date, end_date, full_day=None):
#     def get_past_meeting_of_user(cls, session, username, start_date):
#     def get_future_single_meeting_of_user(
#             cls, session, username, start_date=date.today()):
#     def get_future_regular_meeting_of_user(
#             cls, session, username, start_date=date.today()):
#     def get_meeting_with_reminder(
#             cls, session, start_date, start_time, stop_time, offset):
#     def expand_regular_meetings(
#             meetings_in, start_date=None, end_date=None):
#     def search(cls, session, keyword):
#     def search_locations(cls, session, keyword):
#     def get_locations(cls, session):
#     def clear_from_calendar(cls, session, calendar):
#     def __init__(
#             self, reminder_offset, reminder_from,
#             reminder_to, reminder_text):
#     def __repr__(self):
#     def save(self, session):
#     def by_id(cls, session, identifier):
# class CalendarStatus(BASE):
# class Calendar(BASE):
# class User(BASE):
# class MeetingsUsers(BASE):
# class Meeting(BASE):
# class Reminder(BASE):


import sys
import os
import sqlalchemy as sa
import sqlalchemy.orm as orm
import sqlalchemy.exc
import fedocal.fedocallib
from fedocal.fedocallib import model
    sa.orm.mapper(F03Reminders, table)

    scopedsession = orm.scoped_session(orm.sessionmaker(bind=engine))
    return scopedsession


def convert_calendars(fed03_sess, fed04_sess):
    ''' Convert the Calendars from fedocal-0.3.x to fedocal-0.4.0.
    '''
    cnt = 0
    for calendar in fed03_sess.query(F03Calendars).all():
        calendarobj = model.Calendar(
            calendar_name=calendar.calendar_name,
            calendar_contact=calendar.calendar_contact,
            calendar_description=calendar.calendar_description,
            calendar_editor_group=calendar.calendar_editor_group,
            calendar_admin_group=calendar.calendar_admin_group,
            calendar_status=calendar.calendar_status
        )
        fed04_sess.add(calendarobj)
        cnt += 1
    fed04_sess.commit()
    print('%s calendars added' % cnt)


def convert_reminders(fed03_sess, fed04_sess):
    ''' Convert the Reminders from fedocal-0.3.x to fedocal-0.4.0.
    '''
    cnt = 0
    for reminder in fed03_sess.query(F03Reminders).all():

# Path: fedocal/fedocallib/model.py
# BASE = declarative_base()
#     CONFIG = ConfigParser.ConfigParser()
# def create_tables(db_url, alembic_ini=None, debug=False):
# def drop_tables(db_url, engine):  # pragma: no cover
# def fill_default_status(session):
#     def __init__(self, status):
#     def __repr__(self):  # pragma: no cover
#     def all(cls, session):
#     def __init__(
#             self, calendar_name, calendar_contact, calendar_description,
#             calendar_editor_group=None, calendar_admin_group=None,
#             calendar_status='Enabled'):
#     def __repr__(self):
#     def to_json(self):
#     def save(self, session):
#     def delete(self, session):
#     def admin_groups(self):
#     def editor_groups(self):
#     def by_id(cls, session, identifier):
#     def get_editor_groups(cls, session, identifier):
#     def get_admin_groups(cls, session, identifier):
#     def get_all(cls, session):
#     def by_status(cls, session, status):
#     def __repr__(self):
#     def get_or_create(cls, session, username):
#     def create(cls, session, username):
#     def __repr__(self):
#     def get_or_create(cls, session, meeting, user):
#     def create(cls, session, meeting, user):
#     def __init__(
#             self, meeting_name,
#             meeting_date, meeting_date_end,
#             meeting_time_start, meeting_time_stop,
#             meeting_information, calendar_name, meeting_timezone='UTC',
#             reminder_id=None, meeting_location=None, recursion_frequency=None,
#             recursion_ends=None, full_day=False):
#     def __repr__(self):
#     def save(self, session):
#     def to_json(self):
#     def add_manager(self, session, meeting_manager):
#     def clear_managers(self, session):
#     def meeting_manager(self):
#     def delete(self, session):
#     def copy(self, meeting=None):
#     def by_id(cls, session, identifier):
#     def get_by_date(
#             cls, session, calendar, start_date, stop_date,
#             full_day=None, no_recursive=False,
#             name=None):
#     def get_by_date_and_location(
#             cls, session, calendar, start_date, stop_date, location):
#     def get_by_date_at_location(
#             cls, session, location, start_date, stop_date, full_day=None,
#             no_recursive=False):
#     def get_overlaping_meetings(
#             cls, session, calendar, start_date, stop_date):
#     def get_at_date(cls, session, calendar, meeting_date, full_day=None):
#     def get_active_regular_meeting(
#             cls, session, calendar, start_date, end_date, full_day=None):
#     def get_active_regular_meeting_at_location(
#             cls, session, location, start_date, end_date, full_day=None):
#     def get_regular_meeting_at_date(
#             cls, session, calendar, end_date, full_day=None):
#     def get_active_regular_meeting_by_date(
#             cls, session, calendar, start_date, full_day=None, name=None):
#     def get_active_regular_meeting_by_date_at_location(
#             cls, session, location, start_date, full_day=None):
#     def get_regular_meeting_by_date(
#             cls, session, calendar, start_date, end_date, full_day=None,
#             name=None):
#     def get_regular_meeting_by_date_at_location(
#             cls, session, location, start_date, end_date, full_day=None):
#     def get_past_meeting_of_user(cls, session, username, start_date):
#     def get_future_single_meeting_of_user(
#             cls, session, username, start_date=date.today()):
#     def get_future_regular_meeting_of_user(
#             cls, session, username, start_date=date.today()):
#     def get_meeting_with_reminder(
#             cls, session, start_date, start_time, stop_time, offset):
#     def expand_regular_meetings(
#             meetings_in, start_date=None, end_date=None):
#     def search(cls, session, keyword):
#     def search_locations(cls, session, keyword):
#     def get_locations(cls, session):
#     def clear_from_calendar(cls, session, calendar):
#     def __init__(
#             self, reminder_offset, reminder_from,
#             reminder_to, reminder_text):
#     def __repr__(self):
#     def save(self, session):
#     def by_id(cls, session, identifier):
# class CalendarStatus(BASE):
# class Calendar(BASE):
# class User(BASE):
# class MeetingsUsers(BASE):
# class Meeting(BASE):
# class Reminder(BASE):


# Path: alembic/update03_to_04.py
import sys
import os
import sqlalchemy as sa
import sqlalchemy.orm as orm
import sqlalchemy.exc
import fedocal.fedocallib
from fedocal.fedocallib import model

    sa.orm.mapper(F03Reminders, table)

    scopedsession = orm.scoped_session(orm.sessionmaker(bind=engine))
    return scopedsession


def convert_calendars(fed03_sess, fed04_sess):
    ''' Convert the Calendars from fedocal-0.3.x to fedocal-0.4.0.
    '''
    cnt = 0
    for calendar in fed03_sess.query(F03Calendars).all():
        calendarobj = model.Calendar(
            calendar_name=calendar.calendar_name,
            calendar_contact=calendar.calendar_contact,
            calendar_description=calendar.calendar_description,
            calendar_editor_group=calendar.calendar_editor_group,
            calendar_admin_group=calendar.calendar_admin_group,
            calendar_status=calendar.calendar_status
        )
        fed04_sess.add(calendarobj)
        cnt += 1
    fed04_sess.commit()
    print('%s calendars added' % cnt)


def convert_reminders(fed03_sess, fed04_sess):
    ''' Convert the Reminders from fedocal-0.3.x to fedocal-0.4.0.
    '''
    cnt = 0
    for reminder in fed03_sess.query(F03Reminders).all():

        reminderobj = model.Reminder(