Mercurial > repos > bcclaywell > argo_navis
comparison venv/lib/python2.7/site-packages/boto/compat.py @ 0:d67268158946 draft
planemo upload commit a3f181f5f126803c654b3a66dd4e83a48f7e203b
author | bcclaywell |
---|---|
date | Mon, 12 Oct 2015 17:43:33 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:d67268158946 |
---|---|
1 # Copyright (c) 2012 Amazon.com, Inc. or its affiliates. All Rights Reserved | |
2 # | |
3 # Permission is hereby granted, free of charge, to any person obtaining a | |
4 # copy of this software and associated documentation files (the | |
5 # "Software"), to deal in the Software without restriction, including | |
6 # without limitation the rights to use, copy, modify, merge, publish, dis- | |
7 # tribute, sublicense, and/or sell copies of the Software, and to permit | |
8 # persons to whom the Software is furnished to do so, subject to the fol- | |
9 # lowing conditions: | |
10 # | |
11 # The above copyright notice and this permission notice shall be included | |
12 # in all copies or substantial portions of the Software. | |
13 # | |
14 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |
15 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- | |
16 # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT | |
17 # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | |
18 # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
19 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | |
20 # IN THE SOFTWARE. | |
21 # | |
22 import os | |
23 | |
24 # This allows boto modules to say "from boto.compat import json". This is | |
25 # preferred so that all modules don't have to repeat this idiom. | |
26 try: | |
27 import simplejson as json | |
28 except ImportError: | |
29 import json | |
30 | |
31 | |
32 # Switch to use encodebytes, which deprecates encodestring in Python 3 | |
33 try: | |
34 from base64 import encodebytes | |
35 except ImportError: | |
36 from base64 import encodestring as encodebytes | |
37 | |
38 | |
39 # If running in Google App Engine there is no "user" and | |
40 # os.path.expanduser() will fail. Attempt to detect this case and use a | |
41 # no-op expanduser function in this case. | |
42 try: | |
43 os.path.expanduser('~') | |
44 expanduser = os.path.expanduser | |
45 except (AttributeError, ImportError): | |
46 # This is probably running on App Engine. | |
47 expanduser = (lambda x: x) | |
48 | |
49 from boto.vendored import six | |
50 | |
51 from boto.vendored.six import BytesIO, StringIO | |
52 from boto.vendored.six.moves import filter, http_client, map, _thread, \ | |
53 urllib, zip | |
54 from boto.vendored.six.moves.queue import Queue | |
55 from boto.vendored.six.moves.urllib.parse import parse_qs, quote, unquote, \ | |
56 urlparse, urlsplit | |
57 from boto.vendored.six.moves.urllib.request import urlopen | |
58 | |
59 if six.PY3: | |
60 # StandardError was removed, so use the base exception type instead | |
61 StandardError = Exception | |
62 long_type = int | |
63 from configparser import ConfigParser | |
64 else: | |
65 StandardError = StandardError | |
66 long_type = long | |
67 from ConfigParser import SafeConfigParser as ConfigParser |