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

Class Event

source code

object --+
         |
        Event

Model of all event specific ranking information. The default implementation uses SequenceCourseValidator, TimeScoreing and SelfstartStarttime. Subclass this class to customize your event.

Instance Methods [hide private]
 
__init__(self, header={}, extra_rankings=[], template_dir='templates', print_template='course.tex', html_template='course.html', cache=None, store=None)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
remove_cache(self)
Removes the cache.
source code
 
clear_cache(self, obj=None)
Clear the cache
source code
 
validate(self, obj, validator_class=None, args=None)
Get a validator
source code
 
score(self, obj, scoreing_class=None, args=None)
Get the score of an object
source code
 
ranking(self, obj, scoreing_class=None, validation_class=None, scoreing_args=None, validation_args=None, reverse=False)
Get a ranking for a Rankable object
source code
 
format_ranking(self, rankings, type='html')
Returns: RankingFormatter object for the ranking
source code
 
list_rankings(self)
Returns: list of possible rankings
source code
 
list_courses(self)
Returns: list of all courses in the event
source code
 
list_categories(self)
Returns: list of all categories in the event
source code

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

Static Methods [hide private]
 
_var_key(var)
recursively make a hashable key out of a variable
source code
 
_key(cls, args)
make a hashable key out of cls and args
source code
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, header={}, extra_rankings=[], template_dir='templates', print_template='course.tex', html_template='course.html', cache=None, store=None)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  • header (dict of strings) - gerneral information for the ranking header. Typical keys: 'organiser', 'map', 'place', 'date', 'event'
  • extra_rankings (list of tuples (description (string), ranking_args), ranking_args is a dicts with keys for the ranking method: 'rankable', 'scoreing_class', 'validation_class', 'scoreing_args', 'validation_args', 'reverse',) - list of extra rankings
  • template_dir - templates directory
  • print_template - template for printing (latex)
  • html_template - template for html output (screen display)
  • cache - Cache to use for this object
  • store - Store to retrieve possible rankings
Overrides: object.__init__

remove_cache(self)

source code 

Removes the cache. No caching occurs anymore.

clear_cache(self, obj=None)

source code 

Clear the cache

Parameters:
  • obj - Only clear the cache for obj

validate(self, obj, validator_class=None, args=None)

source code 

Get a validator

Parameters:
  • obj - object to validate,
  • validator_class - validation class used
  • args - dict of keyword arguments for the validation strategy object
Returns:
validation result from validator_class.validate(obj)

See Also: Validator for more information about validation classes

score(self, obj, scoreing_class=None, args=None)

source code 

Get the score of an object

Parameters:
  • obj - object to score
  • scoreing_class - scoreing strategy used
  • args (dict of keyword arguments) - additional arguments for the scoreing class's constructor
Returns:
scoreing result from scoreing_class.score(obj)

See Also: AbstractScoreing for more information about scoreing classes

ranking(self, obj, scoreing_class=None, validation_class=None, scoreing_args=None, validation_args=None, reverse=False)

source code 

Get a ranking for a Rankable object

Parameters:
  • obj - ranked object (Category, Course, ...)
  • scoreing_class - scoreing strategy used, None for default strategy
  • validation_class - validation strategy used, None for default strategy
  • scoreing_args - scoreing args, None for default args
  • validation_args - validation args, None for default args
  • reverse - produce reversed ranking

format_ranking(self, rankings, type='html')

source code 
Parameters:
  • ranking (list of objects of class Ranking) - Rankings to format
  • type - 'html' (default) or 'print'
Returns:
RankingFormatter object for the ranking

list_rankings(self)

source code 
Returns:
list of possible rankings

list_courses(self)

source code 
Returns:
list of all courses in the event

list_categories(self)

source code 
Returns:
list of all categories in the event