mirror of
https://github.com/rembo10/headphones.git
synced 2026-07-19 23:44:01 +01:00
Initial python3 changes
Mostly just updating libraries, removing string encoding/decoding, fixing some edge cases. No new functionality was added in this commit.
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
"""
|
||||
JSON support.
|
||||
|
||||
Expose preferred json module as json and provide encode/decode
|
||||
convenience functions.
|
||||
"""
|
||||
|
||||
try:
|
||||
# Prefer simplejson
|
||||
import simplejson as json
|
||||
except ImportError:
|
||||
import json
|
||||
|
||||
|
||||
__all__ = ['json', 'encode', 'decode']
|
||||
|
||||
|
||||
decode = json.JSONDecoder().decode
|
||||
_encode = json.JSONEncoder().iterencode
|
||||
|
||||
|
||||
def encode(value):
|
||||
"""Encode to bytes."""
|
||||
for chunk in _encode(value):
|
||||
yield chunk.encode('utf-8')
|
||||
Reference in New Issue
Block a user