python: Replace ujson with orjson.

Fixes #6507.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2020-08-06 16:09:47 -07:00
committed by Tim Abbott
parent 123790a72d
commit 61d0417e75
132 changed files with 1319 additions and 1238 deletions

View File

@@ -3,14 +3,14 @@ import os
import random
from typing import Any, Dict, List
import ujson
import orjson
from scripts.lib.zulip_tools import get_or_create_dev_uuid_var_path
def load_config() -> Dict[str, Any]:
with open("zerver/tests/fixtures/config.generate_data.json") as infile:
config = ujson.load(infile)
with open("zerver/tests/fixtures/config.generate_data.json", "rb") as infile:
config = orjson.loads(infile.read())
return config
@@ -182,8 +182,8 @@ def remove_line_breaks(fh: Any) -> List[str]:
def write_file(paragraphs: List[str], filename: str) -> None:
with open(filename, "w") as outfile:
outfile.write(ujson.dumps(paragraphs))
with open(filename, "wb") as outfile:
outfile.write(orjson.dumps(paragraphs))
def create_test_data() -> None: