Skip to content

Commit

Permalink
Replace simplejson with stdlib json
Browse files Browse the repository at this point in the history
  • Loading branch information
Jing Wang committed Aug 13, 2023
1 parent 6be858c commit a188c15
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
1 change: 0 additions & 1 deletion dev_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ pytest-random
pyupgrade
sphinx
types-requests
types-simplejson
3 changes: 1 addition & 2 deletions generate_class_from_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#ContentSummary_JSON_Schema
"""
import json
import sys
from typing import Any
from typing import Dict

import simplejson as json

TYPE_MAPPING = {
"integer": "int",
"string": "str",
Expand Down
7 changes: 3 additions & 4 deletions pyhdfs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import base64
import binascii
import getpass
import json
import logging
import os
import posixpath
Expand All @@ -34,8 +35,6 @@

import requests.api
import requests.exceptions
import simplejson
import simplejson.scanner

DEFAULT_PORT = 50070
WEBHDFS_PATH = "/webhdfs/v1"
Expand Down Expand Up @@ -824,7 +823,7 @@ def list_xattrs(self, path: str, **kwargs: _PossibleArgumentTypes) -> List[str]:
:rtype: list
"""
result = simplejson.loads(
result = json.loads(
_json(self._get(path, "LISTXATTRS", **kwargs))["XAttrNames"]
)
assert isinstance(result, list), type(result)
Expand Down Expand Up @@ -982,7 +981,7 @@ def _json(response: requests.Response) -> Dict[str, Any]:
js = response.json()
assert isinstance(js, dict), type(js)
return js
except simplejson.scanner.JSONDecodeError:
except json.decoder.JSONDecodeError:
raise HdfsException(f"Expected JSON. Is WebHDFS enabled? Got {response.text!r}")


Expand Down
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ classifiers =
[options]
install_requires =
requests
simplejson
python_requires = >=3.6
packages = pyhdfs

Expand Down

0 comments on commit a188c15

Please sign in to comment.