From b87495734dafad20e602996d3133a380bdc18924 Mon Sep 17 00:00:00 2001 From: Vincent Jacques Date: Wed, 22 Feb 2012 20:13:54 +0000 Subject: [PATCH] Refactor --- github/ObjectCapacities/List.py | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/github/ObjectCapacities/List.py b/github/ObjectCapacities/List.py index 676d24ab..086df726 100644 --- a/github/ObjectCapacities/List.py +++ b/github/ObjectCapacities/List.py @@ -2,23 +2,6 @@ import itertools import ArgumentsChecker -class ListOfReferences: - def __init__( self, attributeName, type, addable = False, removable = False, hasable = False, getParameters = [] ): - self.__capacities = list() - self.attributeName = attributeName - self.type = type - self.__capacities.append( ListGetable( [], getParameters ) ) - if addable: - self.__capacities.append( ElementAddable() ) - if removable: - self.__capacities.append( ElementRemoveable() ) - if hasable: - self.__capacities.append( ElementHasable() ) - - def apply( self, cls ): - for capacity in self.__capacities: - capacity.apply( self, cls ) - class ElementAddable: def apply( self, list, cls ): self.__type = list.type @@ -102,3 +85,15 @@ class ListOfObjects: def apply( self, cls ): for capacity in self.__capacities: capacity.apply( self, cls ) + +class ListOfReferences( ListOfObjects ): + def __init__( self, attributeName, type, addable = False, removable = False, hasable = False, getParameters = [] ): + capacities = list() + capacities.append( ListGetable( [], getParameters ) ) + if addable: + capacities.append( ElementAddable() ) + if removable: + capacities.append( ElementRemoveable() ) + if hasable: + capacities.append( ElementHasable() ) + ListOfObjects.__init__( self, attributeName, type, *capacities )