<s> from robot . utils import setter <EOL> from itemlist import ItemList <EOL> from message import Message , Messages <EOL> from modelobject import ModelObject <EOL> class Keyword ( ModelObject ) : <EOL> __slots__ = [ '<STR_LIT>' , '<STR_LIT:name>' , '<STR_LIT>' , '<STR_LIT:args>' , '<STR_LIT:type>' , '<STR_LIT>' ] <EOL> KEYWORD_TYPE = '<STR_LIT>' <EOL> SETUP_TYPE = '<STR_LIT>' <EOL> TEARDOWN_TYPE = '<STR_LIT>' <EOL> FOR_LOOP_TYPE = '<STR_LIT>' <EOL> FOR_ITEM_TYPE = '<STR_LIT>' <EOL> message_class = Message <EOL> def __init__ ( self , name = '<STR_LIT>' , doc = '<STR_LIT>' , args = None , type = '<STR_LIT>' , timeout = '<STR_LIT>' ) : <EOL> self . parent = None <EOL> self . name = name <EOL> self . doc = doc <EOL> self . args = args or [ ] <EOL> self . type = type <EOL> self . timeout = timeout <EOL> self . messages = [ ] <EOL> self . keywords = [ ] <EOL> @ setter <EOL> def keywords ( self , keywords ) : <EOL> return Keywords ( self . __class__ , self , keywords ) <EOL> @ setter <EOL> def messages ( self , messages ) : <EOL> return Messages ( self . message_class , self , messages ) <EOL> @ property <EOL> def id ( self ) : <EOL> if not self . parent : <EOL> return '<STR_LIT>' <EOL> return '<STR_LIT>' % ( self . parent . id , self . parent . keywords . index ( self ) + <NUM_LIT:1> ) <EOL> def visit ( self , visitor ) : <EOL> visitor . visit_keyword ( self ) <EOL> class Keywords ( ItemList ) : <EOL> __slots__ = [ ] <EOL> def __init__ ( self , keyword_class = Keyword , parent = None , keywords = None ) : <EOL> ItemList . __init__ ( self , keyword_class , { '<STR_LIT>' : parent } , keywords ) <EOL> @ property <EOL> def setup ( self ) : <EOL> return self [ <NUM_LIT:0> ] if ( self and self [ <NUM_LIT:0> ] . type == '<STR_LIT>' ) else None <EOL> @ property <EOL> def teardown ( self ) : <EOL> return self [ - <NUM_LIT:1> ] if ( self and self [ - <NUM_LIT:1> ] . type == '<STR_LIT>' ) else None <EOL> @ property <EOL> def all ( self ) : <EOL> return self <EOL> @ property <EOL> def normal ( self ) : <EOL> for kw in self : <EOL> if kw . type not in ( '<STR_LIT>' , '<STR_LIT>' ) : <EOL> yield kw </s>
