Package moviestat :: Module movie_chart_file :: Class MovieChartFile
[hide private]
[frames] | no frames]

Class MovieChartFile

object --+
         |
        MovieChartFile

This class represents files which contain IMDB movie charts. It provides a method read_all for reading the movie data from such files.

A movie chart file is expected to contain the data for one movie per line, with each line containing the rating, year, title and director of the movie, separated by '#' characters. E.g. :

   9.1 # 1972 # The Godfather                # Francis Ford Coppola
   9.0 # 1994 # The Shawshank Redemption     # Frank Darabont
Instance Methods [hide private]
 
__init__(self, file_path)
Creates a new file reader object which reads its data from the file at the given location.
list
read_all(self)
Reads all the movie objects, in order, from the file.

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, file_path)
(Constructor)

 

Creates a new file reader object which reads its data from the file at the given location.

Parameters:
  • file_path - the path to the data
Overrides: object.__init__

read_all(self)

 

Reads all the movie objects, in order, from the file.

Returns: list
a list of the movies in the file

Note: raises IOError if the file could not be read or its contents are invalid