splitinerary package

Submodules

splitinerary.custom_event module

class splitinerary.custom_event.CustomEvent(event_name, description, start_time, end_time, cost=0, *args, **kw)[source]

Bases: Event

Custom Events like concerts, parties, shows, etc.

splitinerary.event module

class splitinerary.event.Event(datetime, users=None)[source]

Bases: object

Event object. Each event is sortable among other Events by datetime.

Attributes:
datetime (datetime.datetime): when the user wants to arrive at

the event, NOT NECESSARILY when the event starts (e.g. user might arrive at the airport 2 hours before the flight departs).

add_user(user)[source]

Add user to Event.

Args:

user (User): User to add to Event.

get_date()[source]

Get date of Event.

Returns:

datetime.Date: Date the event takes place on.

get_time()[source]

Get time of Event (without the date).

Returns:

datetime.Time: Time the event takes place on.

get_users()[source]

Get Users participating in Event.

Returns:
list of User: Users participating in Event if there are any,

else None.

splitinerary.transportation module

class splitinerary.transportation.Boat(departure_terminal, arrival_terminal, route=None, *args, **kw)[source]

Bases: Transportation

Boat transportation method.

class splitinerary.transportation.Car(departure_location, arrival_location, company=None, *args, **kw)[source]

Bases: Transportation

Car transportation method.

class splitinerary.transportation.Plane(flight_number, departure_terminal=None, arrival_terminal=None, *args, **kw)[source]

Bases: Transportation

Plane transportation method.

class splitinerary.transportation.Train(departure_station, arrival_station, train_line=None, *args, **kw)[source]

Bases: Transportation

Train transporation method.

class splitinerary.transportation.Transportation(departure_time, arrival_time, cost=0, confirmation_code=None, *args, **kw)[source]

Bases: Event

Transporation object that the vehicle objects inherit from.

splitinerary.trip module

class splitinerary.trip.Trip[source]

Bases: object

Trip object that everything else in Splitinerary gets added to.

Attributes:
dates_list (list of datetime.date): sortable list of datetime.date,

used to keep track of which dates have events on them.

dates_dict (dict of datetime.dateevent.Event):

keys can be used to see if date exists in trip, values are lists (that can be sorted) of each day’s events.

user_activities (dict of user: {date: [event1, event2]}):

Maps users to their activities on dates

add_event(event)[source]

Add an Event object to the Trip. This involves adding the date of the event to self.dates_list and adding the event to self.dates_dict[date].

Args:

event (Event): The event to be added to the Trip.

add_user_to_event(user, event)[source]

Add a user to an Event in the Trip.

Args:

user (User): User to add to the Event. event (Event): Event from which User is being added.

get_all_events()[source]

Returns all events in the Trip in order of start time.

Returns:

list of Event: sorted list of all events in the trip.

get_eventful_dates()[source]
Print all of the dates that have an event on them in order of start

time.

Returns:

list of datetime.date: sorted list of dates that have events on them if it exists, else None.

get_events_of_user(user)[source]

Gets the events of a given User.

Args:

user (User): A User in the Trip.

Returns:

dict of user: {date: [event1, event2]} : dictionary of user’s events for each day.

get_events_on_date(date)[source]

Returns of the events on a certain day in order of start time.

Args:

date (datetime.date): the date whose events are to be returned.

Returns:

list of (datetime.time, Event): sorted list of tuples of events on the input date if it exists, else None.

get_next_event()[source]

Returns the next event that will take place for any user.

Returns:

Event: the next event that will take place for any User if it exists, else None.

get_users_list()[source]

Gets list of users participating in Trip.

Returns:

list of Users: A list of users participating in Trip.

remove_event_by_index(date, index)[source]

Remove an Event from a Trip given a date and index of Event on date.

Args:

date (datetime.Date): Date of event. index (int): Index of Event on date, in order of time.

remove_user_from_event(user, event)[source]

Remove a User from an Event in the Trip.

Args:

user (User): User to remove from Event. event (Event): Event from which User is being removed.

splitinerary.user module

class splitinerary.user.User(first_name, last_name, email=None)[source]

Bases: object

User object to represent people participating in a Trip.

Attributes:

first_name (str): First name of person. last_name (str): Last name of person. email (str, optional): Email of person. Defaults to None.

get_email()[source]

Get the email of a User.

Returns:

str: The email of the User.

Module contents

class splitinerary.Boat(departure_terminal, arrival_terminal, route=None, *args, **kw)[source]

Bases: Transportation

Boat transportation method.

class splitinerary.Car(departure_location, arrival_location, company=None, *args, **kw)[source]

Bases: Transportation

Car transportation method.

class splitinerary.CustomEvent(event_name, description, start_time, end_time, cost=0, *args, **kw)[source]

Bases: Event

Custom Events like concerts, parties, shows, etc.

class splitinerary.Event(datetime, users=None)[source]

Bases: object

Event object. Each event is sortable among other Events by datetime.

Attributes:
datetime (datetime.datetime): when the user wants to arrive at

the event, NOT NECESSARILY when the event starts (e.g. user might arrive at the airport 2 hours before the flight departs).

add_user(user)[source]

Add user to Event.

Args:

user (User): User to add to Event.

get_date()[source]

Get date of Event.

Returns:

datetime.Date: Date the event takes place on.

get_time()[source]

Get time of Event (without the date).

Returns:

datetime.Time: Time the event takes place on.

get_users()[source]

Get Users participating in Event.

Returns:
list of User: Users participating in Event if there are any,

else None.

class splitinerary.Plane(flight_number, departure_terminal=None, arrival_terminal=None, *args, **kw)[source]

Bases: Transportation

Plane transportation method.

class splitinerary.Train(departure_station, arrival_station, train_line=None, *args, **kw)[source]

Bases: Transportation

Train transporation method.

class splitinerary.Transportation(departure_time, arrival_time, cost=0, confirmation_code=None, *args, **kw)[source]

Bases: Event

Transporation object that the vehicle objects inherit from.

class splitinerary.Trip[source]

Bases: object

Trip object that everything else in Splitinerary gets added to.

Attributes:
dates_list (list of datetime.date): sortable list of datetime.date,

used to keep track of which dates have events on them.

dates_dict (dict of datetime.dateevent.Event):

keys can be used to see if date exists in trip, values are lists (that can be sorted) of each day’s events.

user_activities (dict of user: {date: [event1, event2]}):

Maps users to their activities on dates

add_event(event)[source]

Add an Event object to the Trip. This involves adding the date of the event to self.dates_list and adding the event to self.dates_dict[date].

Args:

event (Event): The event to be added to the Trip.

add_user_to_event(user, event)[source]

Add a user to an Event in the Trip.

Args:

user (User): User to add to the Event. event (Event): Event from which User is being added.

get_all_events()[source]

Returns all events in the Trip in order of start time.

Returns:

list of Event: sorted list of all events in the trip.

get_eventful_dates()[source]
Print all of the dates that have an event on them in order of start

time.

Returns:

list of datetime.date: sorted list of dates that have events on them if it exists, else None.

get_events_of_user(user)[source]

Gets the events of a given User.

Args:

user (User): A User in the Trip.

Returns:

dict of user: {date: [event1, event2]} : dictionary of user’s events for each day.

get_events_on_date(date)[source]

Returns of the events on a certain day in order of start time.

Args:

date (datetime.date): the date whose events are to be returned.

Returns:

list of (datetime.time, Event): sorted list of tuples of events on the input date if it exists, else None.

get_next_event()[source]

Returns the next event that will take place for any user.

Returns:

Event: the next event that will take place for any User if it exists, else None.

get_users_list()[source]

Gets list of users participating in Trip.

Returns:

list of Users: A list of users participating in Trip.

remove_event_by_index(date, index)[source]

Remove an Event from a Trip given a date and index of Event on date.

Args:

date (datetime.Date): Date of event. index (int): Index of Event on date, in order of time.

remove_user_from_event(user, event)[source]

Remove a User from an Event in the Trip.

Args:

user (User): User to remove from Event. event (Event): Event from which User is being removed.

class splitinerary.User(first_name, last_name, email=None)[source]

Bases: object

User object to represent people participating in a Trip.

Attributes:

first_name (str): First name of person. last_name (str): Last name of person. email (str, optional): Email of person. Defaults to None.

get_email()[source]

Get the email of a User.

Returns:

str: The email of the User.