Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: third_party/requests/structures.py

Issue 25004007: Update 'requests' lib to v2.0. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/swarm_client
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 2
3 """ 3 """
4 requests.structures 4 requests.structures
5 ~~~~~~~~~~~~~~~~~~~ 5 ~~~~~~~~~~~~~~~~~~~
6 6
7 Data structures that power Requests. 7 Data structures that power Requests.
8 8
9 """ 9 """
10 10
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 def __eq__(self, other): 96 def __eq__(self, other):
97 if isinstance(other, collections.Mapping): 97 if isinstance(other, collections.Mapping):
98 other = CaseInsensitiveDict(other) 98 other = CaseInsensitiveDict(other)
99 else: 99 else:
100 return NotImplemented 100 return NotImplemented
101 # Compare insensitively 101 # Compare insensitively
102 return dict(self.lower_items()) == dict(other.lower_items()) 102 return dict(self.lower_items()) == dict(other.lower_items())
103 103
104 # Copy is required 104 # Copy is required
105 def copy(self): 105 def copy(self):
106 return CaseInsensitiveDict(self._store.values()) 106 return CaseInsensitiveDict(self._store.values())
107 107
108 def __repr__(self): 108 def __repr__(self):
109 return '%s(%r)' % (self.__class__.__name__, dict(self.items())) 109 return '%s(%r)' % (self.__class__.__name__, dict(self.items()))
110 110
111 111
112 class LookupDict(dict): 112 class LookupDict(dict):
113 """Dictionary lookup object.""" 113 """Dictionary lookup object."""
114 114
115 def __init__(self, name=None): 115 def __init__(self, name=None):
116 self.name = name 116 self.name = name
117 super(LookupDict, self).__init__() 117 super(LookupDict, self).__init__()
118 118
119 def __repr__(self): 119 def __repr__(self):
120 return '<lookup \'%s\'>' % (self.name) 120 return '<lookup \'%s\'>' % (self.name)
121 121
122 def __getitem__(self, key): 122 def __getitem__(self, key):
123 # We allow fall-through here, so values default to None 123 # We allow fall-through here, so values default to None
124 124
125 return self.__dict__.get(key, None) 125 return self.__dict__.get(key, None)
126 126
127 def get(self, key, default=None): 127 def get(self, key, default=None):
128 return self.__dict__.get(key, default) 128 return self.__dict__.get(key, default)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698