Package moviestat :: Module top_movies :: Class TopMovies
[hide private]
[frames] | no frames]

Class TopMovies

source code

object --+
         |
        TopMovies

The class TopMovies represents charts of top-rated movies in a movie database (such as IMDB.com). A TopMovies object can be queried about various statistics through its methods. E.g. "What is the highest-rated movie?", "What is the highest-rated movie made between 1960 and 1969?", "How many movies from 1980 are in the chart?"

Instance Methods [hide private]
 
__init__(self, file_name=None)
Creates a new TopMovies object.
source code
 
get_size(self)
Returns the size of the top movies chart.
source code
 
get_Nth(self, n) source code
 
get_best(self)
Returns the highest-rated movie in the chart.
source code
 
get_position(self, movie)
Returns the position that a given movie occupies in the top movies chart.
source code
 
get_year_count(self, year)
Returns the number of movies that appear in the top movies chart and are from the given year.
source code
 
get_best_of_interval(self, start, end)
Returns the movie which has the highest rating of all movies made between the two given years.
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, file_name=None)
(Constructor)

source code 

Creates a new TopMovies object. An object created this way uses an IMDB.com "Top 250 Movies of All-Time" chart (as voted by website visitors dated August, 2006) as its database.

Overrides: object.__init__

get_size(self)

source code 

Returns the size of the top movies chart. That is, returns the number of movies in the chart.

Returns:
chart size

get_best(self)

source code 

Returns the highest-rated movie in the chart. Calling this method is equivalent to calling get_Nth(1)

Returns:
the best movie, wrt. rating

get_position(self, movie)

source code 

Returns the position that a given movie occupies in the top movies chart.

Parameters:
  • movie - a movie whose chart position is to be determined
Returns:
the given movie's position (a positive integer between 1 and chart size) or a negative number if the given movie does not appear in the chart

get_year_count(self, year)

source code 

Returns the number of movies that appear in the top movies chart and are from the given year.

Parameters:
  • year - the number of any year
Returns:
the number of movies from the given year that appear in the chart

get_best_of_interval(self, start, end)

source code 

Returns the movie which has the highest rating of all movies made between the two given years. For instance, get_best_of_interval(1900, 1940) returns the highest-rated movie made no earlier than 1900 and no later than 1940.

Parameters:
  • start - start year (included in interval)
  • end - end year (included in interval)
Returns:
the highest-rated movie in the given interval