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

jakirkham / zarr / 180 / 3
100%
master: 100%

Build:
DEFAULT BRANCH: master
Ran 19 Apr 2019 11:22PM UTC
Files 30
Run time 1s
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

19 Apr 2019 11:07PM UTC coverage: 98.933% (-0.01%) from 98.944%
180.3

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)

9364 of 9465 relevant lines covered (98.93%)

0.99 hits per line

Source Files on job 180.3
  • Tree
  • List 0
  • Changed 14
  • Source Changed 6
  • Coverage Changed 13
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 178
  • Travis Job 180.3
  • a7546b72 on github
  • Prev Job for on master (#179.1)
  • Next Job for on master (#181.1)
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