Closed danieljfarrell closed 5 years ago
Merging #44 into master will decrease coverage by
12.87%
. The diff coverage is94.54%
.
@@ Coverage Diff @@
## master #44 +/- ##
===========================================
- Coverage 87.35% 74.47% -12.88%
===========================================
Files 8 8
Lines 609 670 +61
===========================================
- Hits 532 499 -33
- Misses 77 171 +94
Impacted Files | Coverage Δ | |
---|---|---|
src/meshcat/tests/test_drawing.py | 72.51% <100%> (-23.6%) |
:arrow_down: |
src/meshcat/geometry.py | 62.91% <88.88%> (-24.04%) |
:arrow_down: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update d26423c...c99f362. Read the comment docs.
This looks great, thanks! Just one minor question before I merge it.
Yes, is better practice. Will update the repo.
Happy with the new changes?
Looks great, thank you!
Changes
If mesh already exists in memory it is inefficient to save the mesh to a file and reload it. This can be avoided using streams.
The
from_file
methods open the file and then load,The
from_steam
methods skip thewith open
step and load the data in the stream directly.StringIO
changes quite a bit between Python 2 and Python 3 and I noticed you are supporting Python 2 so I made it work in both cases.data_from_stream
looks like this,In Python 3 we first check if we are a string or a bytes stream and load accordingly. Python 2 only has
str
types so we can go ahead and just load that.Testing
Tests have been added and pass in both Python 2 and Python 3. The .obj, .stl (ascii and binary) and the .dae files from
tests/data
are loaded into streams and visualised. Loading the text from disk into a stream kind of defeats the purpose of using streams but the round trip is a good test and shows that it works.