Skip to content

Commit 7846520

Browse files
author
Jon Duckworth
authored
Merge pull request #348 from gadomski/fix/read-file
Remove duplicate `read_text` without orjson
2 parents 5158a4c + 9deb0f7 commit 7846520

File tree

6 files changed

+24
-5
lines changed

6 files changed

+24
-5
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,14 @@ jobs:
3939
token: ${{ secrets.CODECOV_TOKEN }}
4040
file: ./coverage.xml
4141
fail_ci_if_error: false
42+
vanilla:
43+
runs-on: ubuntu-latest
44+
steps:
45+
- uses: actions/checkout@v2
46+
- uses: actions/setup-python@v2
47+
with:
48+
python-version: "3.8"
49+
- name: Install without orjson
50+
run: pip install '.[validation]'
51+
- name: Run unittests
52+
run: python -m unittest discover tests

.style.yapf

Lines changed: 0 additions & 2 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
### Changed
88

9+
### Fixed
10+
11+
- Reading json without orjson ([#348](https://github.com/stac-utils/pystac/pull/348))
12+
913
### Remove
1014

1115
## [1.0.0-beta.1]

pystac/stac_io.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
# Use orjson if available
2525
try:
26-
import orjson
26+
import orjson # type: ignore
2727
except ImportError:
2828
orjson = None
2929

@@ -77,7 +77,7 @@ def _json_loads(self, txt: str, source: Union[str, "Link_Type"]) -> Dict[str, An
7777
if orjson is not None:
7878
return orjson.loads(txt)
7979
else:
80-
return json.loads(self.read_text(txt))
80+
return json.loads(txt)
8181

8282
def _json_dumps(
8383
self, json_dict: Dict[str, Any], source: Union[str, "Link_Type"]

scripts/format

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ fi
99
function usage() {
1010
echo -n \
1111
"Usage: $(basename "$0")
12-
Format code with yapf
12+
Format code with black
1313
"
1414
}
1515

tests/test_stac_io.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import unittest
22
import warnings
33

4+
import pystac
45
from pystac.stac_io import STAC_IO
56
from tests.utils import TestCases
67

@@ -18,3 +19,8 @@ def test_stac_io_issues_warnings(self):
1819
# Verify some things
1920
self.assertEqual(len(w), 1)
2021
self.assertTrue(issubclass(w[-1].category, DeprecationWarning))
22+
23+
def test_read_text(self):
24+
_ = pystac.read_file(
25+
TestCases.get_path("data-files/collections/multi-extent.json")
26+
)

0 commit comments

Comments
 (0)