diff options
Diffstat (limited to 'doxygen/man/man3/cmd2_StubbornDict.3')
-rw-r--r-- | doxygen/man/man3/cmd2_StubbornDict.3 | 145 |
1 files changed, 145 insertions, 0 deletions
diff --git a/doxygen/man/man3/cmd2_StubbornDict.3 b/doxygen/man/man3/cmd2_StubbornDict.3 new file mode 100644 index 0000000..dcb6892 --- /dev/null +++ b/doxygen/man/man3/cmd2_StubbornDict.3 @@ -0,0 +1,145 @@ +.TH "cmd2::StubbornDict" 3 "Fri Sep 9 2011" "Cmd2" \" -*- nroff -*- +.ad l +.nh +.SH NAME +cmd2::StubbornDict \- +.SH SYNOPSIS +.br +.PP +.SS "Public Member Functions" + +.in +1c +.ti -1c +.RI "def \fB__add__\fP" +.br +.ti -1c +.RI "def \fB__iadd__\fP" +.br +.ti -1c +.RI "def \fB__radd__\fP" +.br +.ti -1c +.RI "def \fBto_dict\fP" +.br +.ti -1c +.RI "def \fBupdate\fP" +.br +.in -1c +.SS "Static Public Attributes" + +.in +1c +.ti -1c +.RI "\fBappend\fP = update" +.br +.in -1c +.SH "Detailed Description" +.PP +.PP +.nf +Dictionary that tolerates many input formats. +Create it with stubbornDict(arg) factory function. + +>>> d = StubbornDict(large='gross', small='klein') +>>> sorted(d.items()) +[('large', 'gross'), ('small', 'klein')] +>>> d.append(['plain', ' plaid']) +>>> sorted(d.items()) +[('large', 'gross'), ('plaid', ''), ('plain', ''), ('small', 'klein')] +>>> d += ' girl Frauelein, Maedchen\\n\\n shoe schuh' +>>> sorted(d.items()) +[('girl', 'Frauelein, Maedchen'), ('large', 'gross'), ('plaid', ''), ('plain', ''), ('shoe', 'schuh'), ('small', 'klein')] +.fi +.PP + +.PP +Definition at line 271 of file cmd2\&.py'\&. +.SH "Member Function Documentation" +.PP +.SS "def cmd2::StubbornDict::__add__ (self, arg)" +.PP +Definition at line 291 of file cmd2\&.py'\&. +.PP +References cmd2::stubbornDict()\&. +.PP +.nf +291 +292 def __add__(self, arg): +293 selfcopy = copy\&.copy(self) +294 selfcopy\&.update(stubbornDict(arg)) + return selfcopy +.fi +.SS "def cmd2::StubbornDict::__iadd__ (self, arg)" +.PP +Definition at line 288 of file cmd2\&.py'\&. +.PP +References update()\&. +.PP +.nf +288 +289 def __iadd__(self, arg): +290 self\&.update(arg) + return self +.fi +.SS "def cmd2::StubbornDict::__radd__ (self, arg)" +.PP +Definition at line 295 of file cmd2\&.py'\&. +.PP +References cmd2::stubbornDict()\&. +.PP +.nf +295 +296 def __radd__(self, arg): +297 selfcopy = copy\&.copy(self) +298 selfcopy\&.update(stubbornDict(arg)) +299 return selfcopy + +.fi +.SS "def cmd2::StubbornDict::to_dict (cls, arg)" +.PP +Definition at line 301 of file cmd2\&.py'\&. +.PP +.nf +301 +302 def to_dict(cls, arg): +303 'Generates dictionary from string or list of strings' +304 if hasattr(arg, 'splitlines'): +305 arg = arg\&.splitlines() +306 if hasattr(arg, '__reversed__'): +307 result = {} +308 for a in arg: +309 a = a\&.strip() +310 if a: +311 key_val = a\&.split(None, 1) +312 key = key_val[0] +313 if len(key_val) > 1: +314 val = key_val[1] +315 else: +316 val = '' +317 result[key] = val +318 else: +319 result = arg +320 return result + +.fi +.SS "def cmd2::StubbornDict::update (self, arg)" +.PP +Definition at line 285 of file cmd2\&.py'\&. +.PP +Referenced by __iadd__()\&. +.PP +.nf +285 +286 def update(self, arg): + dict\&.update(self, StubbornDict\&.to_dict(arg)) +.fi +.SH "Member Data Documentation" +.PP +.SS "\fBcmd2::StubbornDict::append\fP = update\fC [static]\fP" +.PP +Definition at line 287 of file cmd2\&.py'\&. +.PP +Referenced by cmd2::History::extend()\&. + +.SH "Author" +.PP +Generated automatically by Doxygen for Cmd2 from the source code'\&. |