<s> from itertools import chain <EOL> from robotide . lib . robot . model import Tags <EOL> from robotide . lib . robot . utils import setter <EOL> from . writer import LibdocWriter <EOL> from . output import LibdocOutput <EOL> class LibraryDoc ( object ) : <EOL> def __init__ ( self , name = '<STR_LIT>' , doc = '<STR_LIT>' , version = '<STR_LIT>' , type = '<STR_LIT>' , <EOL> scope = '<STR_LIT>' , named_args = True , doc_format = '<STR_LIT>' ) : <EOL> self . name = name <EOL> self . doc = doc <EOL> self . version = version <EOL> self . type = type <EOL> self . scope = scope <EOL> self . named_args = named_args <EOL> self . doc_format = doc_format <EOL> self . inits = [ ] <EOL> self . keywords = [ ] <EOL> @ setter <EOL> def scope ( self , scope ) : <EOL> return { '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' } . get ( scope , scope ) <EOL> @ setter <EOL> def doc_format ( self , format ) : <EOL> return format or '<STR_LIT>' <EOL> @ setter <EOL> def keywords ( self , kws ) : <EOL> return sorted ( kws ) <EOL> @ property <EOL> def all_tags ( self ) : <EOL> return Tags ( chain . from_iterable ( kw . tags for kw in self . keywords ) ) <EOL> def save ( self , output = None , format = '<STR_LIT>' ) : <EOL> with LibdocOutput ( output , format ) as outfile : <EOL> LibdocWriter ( format ) . write ( self , outfile ) <EOL> class KeywordDoc ( object ) : <EOL> def __init__ ( self , name = '<STR_LIT>' , args = ( ) , doc = '<STR_LIT>' , tags = ( ) ) : <EOL> self . name = name <EOL> self . args = args <EOL> self . doc = doc <EOL> self . tags = Tags ( tags ) <EOL> @ property <EOL> def shortdoc ( self ) : <EOL> return self . doc . splitlines ( ) [ <NUM_LIT:0> ] if self . doc else '<STR_LIT>' <EOL> def __cmp__ ( self , other ) : <EOL> return cmp ( self . name . lower ( ) , other . name . lower ( ) ) </s>
