• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

zarr-developers / zarr / 1490
100%

Build:
DEFAULT BRANCH: master
Ran 19 Apr 2019 11:15PM UTC
Jobs 4
Files 30
Run time 6min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
1490

push

travis-ci

web-flow
Coerce data to text for JSON parsing (#429)

* Rewrite `ensure_str` to be `ensure_text_type`

To simplify the branching required for Python 2/3 compatibility.
Rename `ensure_str` to `ensure_text_type` and rework the code to
coerce data that is `bytes` or `bytes`-like to `bytes` and then to
text data. It appears JSON on Python 2 or Python 3 handles this just
fine. So should make handling these two cases a bit more
straightforward.

* Use `ensure_text_type` elsewhere in `meta`

* Rework `convenience` to use `ensure_text_type`

* Use `ensure_text_type` in `n5`

* Use `ensure_text_type` in attribute tests

* Drop Python 2 workaround for `bson.Binary`

`MongoDBStore` inherited the behavior on `pymongo` with respect to
returning `bson.Binary` for blob values on Python 2. As this caused
some issues on Python 2 when parsing JSON content (as the parser was
unable) to work with objects that were not `bytes` type (i.e.
`bson.Binary`), a workaround was needed to coerce `bson.Binary` to
`bytes` on Python 2. It's worth noting that this workaround is not
needed for loading binary data from chunks as we use the buffer
protocol there.

As we have now fixed our handling of JSON data to coerce data to text
on Python 2/3 and leverage the buffer protocol in the effort, we no
longer need this workaround in `MongoDBStore`. Hence we go ahead and
drop it.

* Simplify `MongoDBStore`'s `__getitem__`'s `return`

* Drop unused import of `binary_type` in `storage`

* Add a helper function for loading JSON

Much as we have a helper function for writing JSON, this adds a
helper function for loading JSON. Mainly it ensure data is coerced to
text before handing it off to the JSON parser. Should simplify code
that is loading JSON.

* Rewrite code to use `json_loads` directly

Changes other library code to use `json_loads` for handling text
encoding and JSON parsing. Should simplify things a bit and avoid
having some errors sneak in.

* ... (continued)

9465 of 9465 relevant lines covered (100.0%)

3.96 hits per line

Jobs
ID Job ID Ran Files Coverage
1 1490.1 19 Apr 2019 11:15PM UTC 0
98.95
Travis Job 1490.1
2 1490.2 19 Apr 2019 11:15PM UTC 0
98.93
Travis Job 1490.2
3 1490.3 19 Apr 2019 11:21PM UTC 0
98.93
Travis Job 1490.3
4 1490.4 19 Apr 2019 11:15PM UTC 0
99.44
Travis Job 1490.4
Source Files on build 1490
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #1490
  • a7546b72 on github
  • Prev Build on master (#1476)
  • Next Build on master (#1498)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc