Use json instead of ujson module

https://ask.replit.com/t/c-stdlib-in-a-python-repl-for-c-extensions-missing-importerror-libstdc-so-6-cannot-open-shared-object-file/1330

Signed-off-by: Ari Archer <ari.web.xyz@gmail.com>
This commit is contained in:
Ari Archer 2022-08-23 04:02:33 +03:00
parent 7cf06b4406
commit 74b0253d8b
Signed by untrusted user who does not match committer: ari
GPG key ID: A50D5B4B599AF8A2
2 changed files with 6 additions and 8 deletions

View file

@ -4,4 +4,3 @@ sqlalchemy-utils
flask
psutil
distro
ujson

View file

@ -4,8 +4,7 @@
import asyncio
import datetime as dt
# import ujson # type: ignore
import json as ujson # For now
import json
import logging
import os
import platform
@ -66,7 +65,7 @@ def dump_config() -> None:
log("Dumping config")
with open(CONFIG_PATH, "w") as cfg:
ujson.dump(CONFIG, cfg, indent=4)
json.dump(CONFIG, cfg, indent=4)
def log(message: str) -> None:
@ -108,11 +107,11 @@ def str_to_command(command: str) -> List[List[str]]:
if len(CACHE["s2c"]) > CONFIG["cache-sz"]:
CACHE["s2c"].clear()
elif command in CACHE["s2c"]:
return ujson.loads(CACHE["s2c"][command])
return json.loads(CACHE["s2c"][command])
result: List[List[str]] = [line.split(" ") for line in command.strip().split("\n")]
CACHE["s2c"][command] = ujson.dumps(result)
CACHE["s2c"][command] = json.dumps(result)
return result
@ -353,7 +352,7 @@ Executed query `{uncode(sql_query)}`
Usage: config"""
await self._send_message(
m(f"\n```json\n{uncode(ujson.dumps(CONFIG, indent=4))}\n```", message)
m(f"\n```json\n{uncode(json.dumps(CONFIG, indent=4))}\n```", message)
)
async def cmd_sh(
@ -637,7 +636,7 @@ def main() -> int:
print(" || Loading config... ", end="")
with open(CONFIG_PATH, "r") as cfg:
CONFIG.update(ujson.load(cfg))
CONFIG.update(json.load(cfg))
print("done")
# Ping server