zulip: Move from simplejson to json.
This removes the simplejson dependency.
MODIFY
zulip/README.md
zulip/README.md
@@ -4,7 +4,6 @@ The [Zulip API](https://zulipchat.com/api) Python bindings require the
following Python libraries:
* requests (version >= 0.12.1)
-* simplejson
* six
* typing (version >= 3.5.2.2)

MODIFY
zulip/integrations/zephyr/sync-public-streams
zulip/integrations/zephyr/sync-public-streams
@@ -4,7 +4,7 @@ import os
import logging
import optparse
import time
-import simplejson
+import json
import subprocess
import unicodedata
@@ -68,7 +68,7 @@ if __name__ == "__main__":
continue
f = open("/home/zulip/public_streams.tmp", "w")
- f.write(simplejson.dumps(list(public_streams)) + "\n")
+ f.write(json.dumps(list(public_streams)) + "\n")
f.close()
subprocess.call(["mv", "/home/zulip/public_streams.tmp", "/home/zulip/public_streams"])

MODIFY
zulip/integrations/zephyr/zephyr_mirror_backend.py
zulip/integrations/zephyr/zephyr_mirror_backend.py
@@ -27,10 +27,7 @@ from types import FrameType
import sys
from six.moves import map
from six.moves import range
-try:
- import simplejson
-except ImportError:
- import json as simplejson # type: ignore
+import json
import re
import time
import subprocess
@@ -205,7 +202,7 @@ def update_subscriptions():
# type: () -> None
try:
f = open(options.stream_file_path, "r")
- public_streams = simplejson.loads(f.read())
+ public_streams = json.loads(f.read())
f.close()
except Exception:
logger.exception("Error reading public streams:")
@@ -447,7 +444,7 @@ def process_notice(notice, log):
logger.info("Received a message on %s/%s from %s..." %
(zephyr_class, notice.instance, notice.sender))
if log is not None:
- log.write(simplejson.dumps(zeph) + '\n')
+ log.write(json.dumps(zeph) + '\n')
log.flush()
if os.fork() == 0:
@@ -552,7 +549,7 @@ def zephyr_to_zulip(options):
with open(options.logs_to_resend, 'r') as log:
for ln in log:
try:
- zeph = simplejson.loads(ln)
+ zeph = json.loads(ln)
# New messages added to the log shouldn't have any
# elements of type str (they should already all be
# unicode), but older messages in the log are

MODIFY
zulip/setup.py
zulip/setup.py
@@ -65,7 +65,6 @@ package_info = dict(
setuptools_info = dict(
install_requires=['requests>=0.12.1',
- 'simplejson',
'six',
'typing>=3.5.2.2',
],
@@ -80,11 +79,6 @@ except ImportError:
from distutils.core import setup
from distutils.version import LooseVersion
# Manual dependency check
- try:
- import simplejson
- except ImportError:
- print("simplejson is not installed", file=sys.stderr)
- sys.exit(1)
try:
import requests
assert(LooseVersion(requests.__version__) >= LooseVersion('0.12.1'))

MODIFY
zulip/zulip/__init__.py
zulip/zulip/__init__.py
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
-import simplejson
+import json
import requests
import time
import traceback
@@ -434,7 +434,7 @@ class Client(object):
if isinstance(val, str) or isinstance(val, Text):
request[key] = val
else:
- request[key] = simplejson.dumps(val)
+ request[key] = json.dumps(val)
for f in files:
req_files.append((f.name, f))
@@ -459,7 +459,7 @@ class Client(object):
else:
sys.stdout.write(".")
sys.stdout.flush()
- query_state["request"]["dont_block"] = simplejson.dumps(True)
+ query_state["request"]["dont_block"] = json.dumps(True)
time.sleep(1)
query_state["failures"] += 1
return True

zulip: Move from simplejson to json.

This removes the simplejson dependency.