<s> """<STR_LIT>""" <EOL> __docformat__ = '<STR_LIT>' <EOL> import re <EOL> import textwrap <EOL> from . constraints import expand_contraint_spec <EOL> _whitespace_re = re . compile ( '<STR_LIT>' ) <EOL> class Parameter ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , constraints = None , doc = None , args = None , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> self . constraints = expand_contraint_spec ( constraints ) <EOL> self . _doc = doc <EOL> self . cmd_args = args <EOL> self . cmd_kwargs = kwargs <EOL> def get_autodoc ( self , name , indent = "<STR_LIT:U+0020>" , width = <NUM_LIT> , default = None , has_default = False ) : <EOL> """<STR_LIT>""" <EOL> paramsdoc = '<STR_LIT:%s>' % name <EOL> if not self . constraints is None : <EOL> sdoc = self . constraints . short_description ( ) <EOL> if not sdoc is None : <EOL> if sdoc [ <NUM_LIT:0> ] == '<STR_LIT:(>' and sdoc [ - <NUM_LIT:1> ] == '<STR_LIT:)>' : <EOL> sdoc = sdoc [ <NUM_LIT:1> : - <NUM_LIT:1> ] <EOL> paramsdoc += "<STR_LIT>" % sdoc <EOL> if has_default : <EOL> paramsdoc += "<STR_LIT>" <EOL> paramsdoc = [ paramsdoc ] <EOL> doc = self . _doc <EOL> if doc is None : <EOL> doc = '<STR_LIT>' <EOL> doc . strip ( ) <EOL> if len ( doc ) and not doc . endswith ( '<STR_LIT:.>' ) : <EOL> doc += '<STR_LIT:.>' <EOL> if self . constraints is not None : <EOL> cdoc = self . constraints . long_description ( ) <EOL> if cdoc [ <NUM_LIT:0> ] == '<STR_LIT:(>' and cdoc [ - <NUM_LIT:1> ] == '<STR_LIT:)>' : <EOL> cdoc = cdoc [ <NUM_LIT:1> : - <NUM_LIT:1> ] <EOL> doc += '<STR_LIT>' % cdoc <EOL> if has_default : <EOL> doc += "<STR_LIT>" % ( default , ) <EOL> doc = _whitespace_re . sub ( '<STR_LIT:U+0020>' , doc ) <EOL> paramsdoc += [ indent + x <EOL> for x in textwrap . wrap ( doc , width = width - len ( indent ) , <EOL> replace_whitespace = True ) ] <EOL> return '<STR_LIT:\n>' . join ( paramsdoc ) </s>
