Skip to content

Conversation

@tetov
Copy link
Contributor

@tetov tetov commented Oct 6, 2019

BaseReader.read_from_location returns an iterable for lines in file.

File format ASCII Binary Skeleton? BaseReader implemented
amf xml x x
dxf x x x x
las x x x
obj x x
off x x
ply x x For ASCII
stl x x Not yet
urdf xml Not yet
xml x Needs whole file to parse?
xml_cli x Needs whole file to parse?

What type of change is this?

  • New feature in a backwards-compatible manner.

Checklist

  1. Add the change to the CHANGELOG.md file in the Unreleased section under the most fitting heading: Added, Changed, Removed.
  2. Run all tests on your computer (i.e. invoke test).
  3. If you add new functions/classes, check that:
    1. Are available on a second-level import, e.g. compas.datastructures.Mesh.
    2. Add unit tests (especially important for algorithm implementations).

Licini and others added 10 commits September 18, 2019 15:13
`BaseReader.read_from_location` returns an iterable for lines in file.

| File format | ASCII | Binary | Skeleton? | BaseReader implemented    |
| ----------- | ----- | ------ | --------- | ------------------------- |
| `amf`       | xml   |        | x         | x                         |
| `dxf`       | x     | x      | x         | x                         |
| `las`       |       | x      | x         | x                         |
| `obj`       | x     |        |           | x                         |
| `off`       | x     |        |           | x                         |
| `ply`       | x     | x      |           | For ASCII                 |
| `stl`       | x     | x      |           | Not yet                   |
| `urdef`     | xml   |        |           | Not yet                   |
| `xml`       | x     |        |           | Needs whole file to parse?|
| `xml_cli`   | x     |        |           | Needs whole file to parse?|
@tetov
Copy link
Contributor Author

tetov commented Oct 6, 2019

I will look into adding the same functionality for binary files, either keep this PR open until that is done or merge this and I'll submit a new PR later on.

Questions

  • Would you like me to move the tests in tests/compas/files/test_stl.py to tests/compas/datastructures/test_mesh.py? Could be fitting to do it in this PR.
  • Would you like me to put the BaseReader class in a file with another name, e.g. _utils.py?
  • I'm guessing that iterating over lines won't work for the XML reader, am I right in that assumption?

@tetov
Copy link
Contributor Author

tetov commented Oct 8, 2019

I updated questions in above comment. :)

Copy link
Contributor

@Licini Licini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Licini
Copy link
Contributor

Licini commented Oct 8, 2019

I will look into adding the same functionality for binary files, either keep this PR open until that is done or merge this and I'll submit a new PR later on.

Questions

  • Would you like me to move the tests in tests/compas/files/test_stl.py to tests/compas/datastructures/test_mesh.py? Could be fitting to do it in this PR.
  • Would you like me to put the BaseReader class in a file with another name, e.g. _utils.py?
  • I'm guessing that iterating over lines won't work for the XML reader, am I right in that assumption?

My thoughts on questions : )

  • Yep, let's merge the content of test_stl.py into test_from_stl in test_mesh.py.
  • It's better to keep as it is for clarity.
  • agree, since it's marked-up language. It would be nice to have an mechanism to throw an error if user tries to load xml in this fashion

@tetov
Copy link
Contributor Author

tetov commented Oct 8, 2019

  • agree, since it's marked-up language. It would be nice to have an mechanism to throw an error if user tries to load xml in this fashion

There's usually checks in the different modules, e.g. ply.py will throw an error if first line is not 'ply'. It could of course be added to the BaseReader as a general check if you want :).

@Licini
Copy link
Contributor

Licini commented Oct 9, 2019

  • agree, since it's marked-up language. It would be nice to have an mechanism to throw an error if user tries to load xml in this fashion

There's usually checks in the different modules, e.g. ply.py will throw an error if first line is not 'ply'. It could of course be added to the BaseReader as a general check if you want :).

That's should be fine then, as long as user be informed the reason of breaking

@tetov
Copy link
Contributor Author

tetov commented Oct 23, 2019

Per IRL discussion with @brgcode, binary ply has not been implemented, so that test will be commented out.

The code needs to be cleaned up, travis errors fixed but it's slowly getting there.

@tetov tetov requested a review from gonzalocasas October 23, 2019 21:05
tetov added 7 commits October 23, 2019 23:06
`BaseReader.read_from_location` returns an iterable for lines in file.

| File format | ASCII | Binary | Skeleton? | BaseReader implemented    |
| ----------- | ----- | ------ | --------- | ------------------------- |
| `amf`       | xml   |        | x         | x                         |
| `dxf`       | x     | x      | x         | x                         |
| `las`       |       | x      | x         | x                         |
| `obj`       | x     |        |           | x                         |
| `off`       | x     |        |           | x                         |
| `ply`       | x     | x      |           | For ASCII                 |
| `stl`       | x     | x      |           | Not yet                   |
| `urdef`     | xml   |        |           | Not yet                   |
| `xml`       | x     |        |           | Needs whole file to parse?|
| `xml_cli`   | x     |        |           | Needs whole file to parse?|
@tetov
Copy link
Contributor Author

tetov commented Oct 28, 2019

Oh and sorry about the amount of commits. Didn’t know a rebase would show up like that on GitHub. I’ll merge next time.

@tomvanmele
Copy link
Member

@gonzalocasas can we merge this?

@tetov
Copy link
Contributor Author

tetov commented Dec 4, 2019

@gonzalocasas, @brgcode
#348 (comment)

Copy link
Member

@gonzalocasas gonzalocasas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to review this in detail, but the rebase thing gets a lot in the way. There are a few things that are not clear to me, some naming things that should change before merging, the removal of tests, and other remarks; but really, the length of the current PR makes it tricky to review. If merging master back into this branch does not get rid of all the spurious diffs, then I would suggest you create a new clean branch, and cherry pick your changes on top of a clean status.

header = next(self.content)
if not header.lower() == 'off':
return
raise Exception('Import failed')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import failed is not very clear, we're not really importing, we're opening files (which will then might be imported into something), so I would be more explicit and limited to this module's functionality in the error message.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to #418.

@tetov
Copy link
Contributor Author

tetov commented Dec 4, 2019

I’ll open a fresh one (and go through the comments).

@tetov
Copy link
Contributor Author

tetov commented Dec 4, 2019

I replied to some. The ones I didn’t reply to I agree to completly.

I’ll move over your comments to new PR. Thanks for reviewing.

Copy link
Contributor Author

@tetov tetov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All unresolved issues moved to #418.

@tetov tetov closed this Dec 5, 2019
@tetov tetov deleted the pathlib_support branch December 5, 2019 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants