Commit Graph

24 Commits

Author SHA1 Message Date
Avi Das c2e6fe4d5d Shorten str for case insensitive dict 2014-03-23 11:38:37 -05:00
Avi Das a3fb689942 Fix parenthesis typo 2014-03-22 16:30:22 -05:00
Avi Das 98ac3df713 Add __str__ to case insensitive dict. Logging headers for debugging purposes is often necessary, and the currently logging the headers would be using __repr__ which would log the implementation detail of headers, caseinsensitivedict. Adding str lends a more printing and log friendly implementation for case insentitice dict 2014-03-22 15:42:23 -05:00
David Pursehouse 4f64938ff0 Fix a few warnings flagged by PyDev
- Unused import of urlparse
- Unnecessary definition of variable
- Incorrect indentation
2013-07-22 17:14:45 +09:00
Colin Dunklau f7596c75dc Rewrite CaseInsensitiveDict to work correctly/sanely
Fixes #649 and #1329 by making Session.headers a CaseInsensitiveDict,
and fixing the implementation of CID. Credit for the brilliant idea
to map `lowercased_key -> (cased_key, mapped_value)` goes to
@gazpachoking, thanks a bunch.

Changes from original implementation of CaseInsensitiveDict:

1.  CID is rewritten as a subclass of `collections.MutableMapping`.
2.  CID remembers the case of the last-set key, but `__setitem__`
    and `__delitem__` will handle keys without respect to case.
3.  CID returns the key case as remembered for the `keys`, `items`,
    and `__iter__` methods.
4.  Query operations (`__getitem__` and `__contains__`) are done in
    a case-insensitive manner: `cid['foo']` and `cid['FOO']` will
    return the same value.
5.  The constructor as well as `update` and `__eq__` have undefined
    behavior when given multiple keys that have the same `lower()`.
6.  The new method `lower_items` is like `iteritems`, but keys are
    all lowercased.
7.  CID raises `KeyError` for `__getitem__` as normal dicts do. The
    old implementation returned
6.  The `__repr__` now makes it obvious that it's not a normal dict.

See PR #1333 for the discussions that lead up to this implementation
2013-04-30 14:52:27 -05:00
oczkers 40a060cf57 it`s more pep8 now 2013-01-27 02:04:12 +01:00
Kenneth Reitz ef8563ab36 CHUNKED REQUESTS! 2013-01-10 01:58:29 -05:00
Ian Cordasco 8081d7b15c Fixes #817.
Use dicts and lists where necessary but accept both dicts and lists of
2-tuples everywhere.
2012-09-02 23:10:28 -04:00
Kenneth Reitz c323047dbe no more multidict 2012-08-21 01:10:55 +10:00
Kenneth Reitz e5fc88ad37 MultiDict 2012-08-21 00:43:16 +10:00
Locker537 42d0a2169e Whitespace fixes following PEP8. 2012-08-16 17:38:35 -04:00
Marcin Wielgoszewski 4b7c5dab0e Expose case-insensitive key access when deleting a key from CaseInsensitiveDict 2012-05-16 13:58:51 -04:00
Kenneth Reitz b0e2e4f284 blah 2012-01-23 00:15:25 -05:00
Kenneth Reitz ec926a4958 test fix 2011-11-12 16:46:53 -05:00
travis 055f7c1eb6 Some Doc and doctoring fixes by the Speling Poleece. 2011-10-19 10:00:13 -05:00
Kenneth Reitz 6cead64345 supporting codes class 2011-08-13 14:50:48 -04:00
Gulácsi Tamás 747f882b0e structures: CaseInsensitiveDict.__delitem__ missing "value" fix 2011-07-23 22:25:07 +02:00
Gulácsi Tamás 04c456b877 structures: little bit more general, lower-key-caching version of CaseInsensitiveDict 2011-07-23 22:16:12 +02:00
James Rowe 5962c0ea86 Subclass dict for CaseInsensitiveDict. 2011-05-27 00:17:44 -07:00
Kenneth Reitz 6e13e7343d Big API update 2011-05-16 01:13:05 -04:00
Kenneth Reitz 35beda21b8 pass things into the dict 2011-05-14 22:02:14 -04:00
Kenneth Reitz 29aa7736ca Headers: Default to None 2011-05-14 21:52:33 -04:00
Kenneth Reitz 5172d24e66 New CaseInsensitiveDict 2011-05-14 21:50:25 -04:00
Kenneth Reitz d3a46c822f preliminary multidicts 2011-04-15 18:00:10 -04:00