If the first parameter is a string, all keys are prefixed with this namespace. Apart from that it works just as the usual dict.update(). Example: ``update('some.namespace', key='value')``
(self, *a, **ka)
| 2133 | return self |
| 2134 | |
| 2135 | def update(self, *a, **ka): |
| 2136 | ''' If the first parameter is a string, all keys are prefixed with this |
| 2137 | namespace. Apart from that it works just as the usual dict.update(). |
| 2138 | Example: ``update('some.namespace', key='value')`` ''' |
| 2139 | prefix = '' |
| 2140 | if a and isinstance(a[0], basestring): |
| 2141 | prefix = a[0].strip('.') + '.' |
| 2142 | a = a[1:] |
| 2143 | for key, value in dict(*a, **ka).items(): |
| 2144 | self[prefix+key] = value |
| 2145 | |
| 2146 | def setdefault(self, key, value): |
| 2147 | if key not in self: |
no test coverage detected