Package drivers_log :: Module event :: Class Event
[hide private]
[frames] | no frames]

Class Event

object --+
         |
        Event

The class Event represents entries in a driver's log. Each entry consists of all the information there was in the file of the entry.

An event object is immutable once created; there are no methods to change any of its attributes.

Instance Methods [hide private]
 
__init__(self, text_line)
Creates a new event object from the data received.
string
get_type(self)
Returns the type of the entry.
date object
get_date(self)
Returns the date of the entry.
time object
get_time(self)
Returns the time of the entry.
int
get_miles(self)
Returns the number of miles in the entry moment.
float
get_gallons(self)
Returns the amount of gallons used to fill in the tank.
string
get_brand(self)
Returns the pruduct brand used in refuelling/oil change.
float
get_total_cost(self)
Returns the total cost of the entry.
string
get_service(self)
Returns the list of service tasks done.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Instance Variables [hide private]
  tags
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, text_line)
(Constructor)

 

Creates a new event object from the data received.

Receives one line from the log file and extracts the information to object variables.

The meaning of the strings in the line are(from left to right):

   "Type","MPG","Date","Time","Vehicle","Odometer","Filled Up","Cost/Gallon","Gallons","Total Cost","Octane","Gas Brand","Location","Tags","Payment Type","Tire Pressure","Notes","Total Cost","Services"

And one line is (for example):

   "Gas","0.0","2010-01-18","10:39 PM","Nissan Versa SL","20406","Full","$2.729","7.255","$19.80","87","Kwik Trip","","","Debit","0.0","","$19.80",""

Types of the fields are as follows. Common fields for all entries:

    type: string
    date: a date object        
    time: a time object with hours an minutes       
    vehicle: string
    odometer: integer
    gas brand: string
    location: string
    payment type: string
    tire pressure: float
    notes: string
    total cost: float

Fields for service entry:

    tags: string
    service: string, multiple operations separated by comma

Fields for refueling entry:

    mpg: float
    filled up: string
    cost/gallon: float
    gallons: float
    total_cost 1: float
    octane: int
Parameters:
  • text_line - one line from the log file as it is there.
Overrides: object.__init__

get_type(self)

 

Returns the type of the entry.

Returns: string
entry type

get_date(self)

 

Returns the date of the entry.

Returns: date object
entry date

get_time(self)

 

Returns the time of the entry.

Returns: time object
entry time

get_miles(self)

 

Returns the number of miles in the entry moment.

Returns: int
odometer reading

get_gallons(self)

 

Returns the amount of gallons used to fill in the tank.

Returns: float
haw many gallons

get_brand(self)

 

Returns the pruduct brand used in refuelling/oil change.

Returns: string
product brand

get_total_cost(self)

 

Returns the total cost of the entry.

Returns: float
total costs

get_service(self)

 

Returns the list of service tasks done.

Returns: string
service tasks

Instance Variable Details [hide private]

tags

Note: variable service is a string, where different service tasks are separated by a comma. for example: , 'oil change', 'inspection'] becomes 'oil change, inspection'