Skip to content
Myr

supporting codes class

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Kenneth Reitz · committed by Kenneth Reitz · parent 773630b · Browse files · 1 file+18 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+18 added−0 removed

  • other:+18 added−0 removed

1 file+18 added−0 removed

modified:requests/structures.py+18 added
43 unmodified lines
44 if key in self:45 return self[key]46 else:47 return default4849class LookupDict(dict):50 """Dictionary lookup object."""5152 def __init__(self, name=None):53 self.name = name54 super(LookupDict, self).__init__()5556 def __repr__(self):57 return '<lookup \'%s\'>' % (self.name)5859 def __getitem__(self, key):60 # We allow fall-through here, so values default to None6162 return self.__dict__.get(key, None)6364 def get(self, key, default=None):65 return self.__dict__.get(key, default)