Check-in [d88aab3981]
Overview
Comment: | Wrap `gzip_decode` as fallback for Python 2. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
d88aab39812eb65a8528ee67503d5f5d |
User & Date: | mario on 2015-04-05 14:09:09 |
Other Links: | manifest | tags |
Context
2015-04-05
| ||
14:09 | Update window title for currently selected category tab. check-in: a6f5f66365 user: mario tags: trunk | |
14:09 | Wrap `gzip_decode` as fallback for Python 2. check-in: d88aab3981 user: mario tags: trunk | |
14:08 | Manually register addon widget signals. Otherwise main keeps bugging with GtkWarnings when timer plugin is disabled. check-in: 33e106bce5 user: mario tags: trunk | |
Changes
Modified compat2and3.py from [26cc8f6b71] to [e41c080b1a].
1 2 3 4 | 1 2 3 4 5 6 7 8 9 10 11 12 | - + | # encoding: UTF-8 # api: python # type: functions # title: Python2 and Python3 compatibility |
︙ | |||
28 29 30 31 32 33 34 35 36 37 38 39 40 41 | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | + + + + | import urllib2 from urllib import urlencode import urlparse import cookielib # filesys from StringIO import StringIO from gzip import GzipFile def gzip_decode(bytes): return GzipFile(fileobj=StringIO(bytes)).read() # return zlib.decompress(bytes, 16 + zlib.MAX_WBITS) # not fully compatible # Python 3 else: # version tags PY2 = 0 |
︙ | |||
50 51 52 53 54 55 56 57 | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | + - + + + + + + + + + + + + | import urllib.request as urllib2 from urllib.parse import urlencode import urllib.parse as urlparse from http import cookiejar as cookielib # filesys from io import StringIO from gzip import decompress as gzip_decode |
Modified config.py from [86c0092432] to [8430e295e9].
︙ | |||
22 23 24 25 26 27 28 29 30 31 32 | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | + - - - - - - - - - | import os import sys import json import gzip import platform import re from compat2and3 import gzip_decode, find_executable import zlib import zipfile import inspect import pkgutil |
︙ | |||
258 259 260 261 262 263 264 | 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | - + - - + + | if server in netrc: return netrc[server] # Retrieve content from install path or pyzip archive (alias for pkgutil.get_data) # |
︙ |