Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ safetest:
export SKIP_TRUE_REDIS=1; export SKIP_TRUE_HTTP=1; make test

publish:
python setup.py sdist upload
python setup.py sdist
pip install -U twine
twine upload dist/mocket-$(shell python -c 'import mocket; print(mocket.__version__)').tar.gz
pip install anaconda-client
anaconda upload dist/mocket-$(shell python -c 'import mocket; print(mocket.__version__)').tar.gz

Expand Down
2 changes: 1 addition & 1 deletion mocket/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

__all__ = (mocketize, Mocket, MocketEntry, Mocketizer)

__version__ = '2.7.3'
__version__ = '2.7.4'
14 changes: 8 additions & 6 deletions mocket/compat.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import codecs
import os
import sys
import shlex
import sys

import six

encoding = os.getenv("MOCKET_ENCODING", 'utf-8')
encoding = os.getenv("MOCKET_ENCODING", "utf-8")

text_type = six.text_type
byte_type = six.binary_type
Expand All @@ -28,6 +29,7 @@ def unquote_utf8(qs):
else:
from http.server import BaseHTTPRequestHandler
from urllib.parse import urlsplit, parse_qs, unquote as unquote_utf8

FileNotFoundError = FileNotFoundError

try:
Expand All @@ -36,15 +38,15 @@ def unquote_utf8(qs):
JSONDecodeError = ValueError


def encode_to_bytes(s, charset=encoding):
def encode_to_bytes(s, encoding=encoding):
if isinstance(s, text_type):
s = s.encode(charset)
s = s.encode(encoding)
return byte_type(s)


def decode_from_bytes(s, charset=encoding):
def decode_from_bytes(s, encoding=encoding):
if isinstance(s, byte_type):
s = s.decode(charset)
s = codecs.decode(s, encoding, "ignore")
return text_type(s)


Expand Down
Loading