Commit Graph

38 Commits

Author SHA1 Message Date
Raymond Hettinger 7e297ed95b Separate collections from collections.abc 2018-06-11 22:14:59 -07:00
schlamar 724fd44b97 revert 8e6e47af and c121b98c 2017-05-04 07:46:59 +02:00
Ian Cordasco 8e6e47af43 Update implementation of TimedCache object
There were some odd decisions made about the implementation of some of
the required methods for MuttableMapping in the TimedCache object. This
cleans those up and makes the implementation, ever so slightly, easier
to read.

See also #3885
2017-03-04 09:03:03 -06:00
David Fontenot c121b98c4e wrapped proxy_bypass() with cache lookup
Used to alleviate long gethostbyaddr calls
Made new TimedCache and decorator to wrap
a function with a cache
* Entries looked up older than a minute (default amount)
are evicted.
* When full, evicts the oldest entry
2017-02-23 14:04:16 -08:00
kennethreitz fb01456061 Merge pull request #3429 from nateprewitt/docstring_cleanup
Docstring cleanup
2016-07-20 18:38:38 -04:00
Nate Prewitt b7809acb47 making class and function docstrings consistent 2016-07-20 11:43:47 -06:00
Nate Prewitt 2d4a89f5dc adding in pep8 fixes 2016-07-20 10:30:08 -06:00
Nate Prewitt 15a3869006 making module docstrings and coding comments consistent 2016-07-19 14:51:14 -06:00
Piotr Jurkiewicz c8a0fc6aa2 Use OrderedDict from .compat module 2016-04-15 04:43:53 +02:00
Piotr Jurkiewicz 4c04469cfb Change _store of CaseInsensitiveDict to OrderedDict 2016-04-14 18:10:50 +02:00
Kevin Burke f0b9b60f62 revert change 2014-08-24 19:46:46 -07:00
Kevin Burke c2aeaa3959 Add support for connect timeouts
Modifies the timeout interface to also accept a tuple (connect, read) which
would be used to set individual connect and read timeouts for Requests. Adds
Advanced documentation explaining the interface and providing guidance for
timeout values.
2014-08-23 15:12:29 -07:00
Josh Schneier 7815953cb4 remove unused IteratorProxy 2014-05-23 11:52:17 -04:00
Kenneth Reitz c15a8f8a3d CaseInsensitiveDict now looks like a normal dict 2014-05-12 15:10:15 -04:00
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