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

Class Event

source code

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.
source code
 
get_type(self)
Returns the type of the entry.
source code
 
get_date(self)
Returns the date of the entry.
source code
 
get_time(self)
Returns the time of the entry.
source code
 
get_miles(self)
Returns the number of miles in the entry moment.
source code
 
get_gallons(self)
Returns the amount of gallons used to fill in the tank.
source code
 
get_brand(self)
Returns the pruduct brand used in refuelling/oil change.
source code
 
get_total_cost(self)
Returns the total cost of the entry.
source code
 
get_service(self)
Returns the list of service tasks done.
source code

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, text_line)
(Constructor)

source code 

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)

source code 

Returns the type of the entry.

Returns:
entry type

get_date(self)

source code 

Returns the date of the entry.

Returns:
entry date

get_time(self)

source code 

Returns the time of the entry.

Returns:
entry time

get_miles(self)

source code 

Returns the number of miles in the entry moment.

Returns:
odometer reading

get_gallons(self)

source code 

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

Returns:
haw many gallons

get_brand(self)

source code 

Returns the pruduct brand used in refuelling/oil change.

Returns:
product brand

get_total_cost(self)

source code 

Returns the total cost of the entry.

Returns:
total costs

get_service(self)

source code 

Returns the list of service tasks done.

Returns:
service tasks