Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Parser and converter refactoring I #220

Merged
merged 31 commits into from
Feb 16, 2018
Merged

Conversation

mpsonntag
Copy link
Contributor

@mpsonntag mpsonntag commented Jan 25, 2018

With the merge of the RDF branch into master, the branch now contains all parsers and converters in the same branch. The parallel development of converters and the odML data format change from v1.0 to v1.1 has lead to dead code, inconsistencies and circular imports. This PR is the first step to reconciling and cleaning up code.

This PR

  • adds a DictParser class, that converts Python dictionary data to odML data and vice versa. Also removes the corresponding parsing code from odmlparser. With this change, odmlparser is now just a clean switch relaying the actual parsing to the different appropriate parsing classes w/o doing any parsing of its own. This is also required to reduce the number of potential circular imports.
  • moves ParserException and SUPPORTED_PARSERS to tools/parser_utils and uses them consistently throughout the project to a) define them only once and b) reduce the number of potential circular imports.
  • closes Clean up imports and resolve import cycles #199: Consistently use relative imports to address circular imports and remove code that
    circumvents previous circular import errors in odmlparser.
  • closes Private members in format classes (Property, Section, Document) #188: refactor format.py to provide getter for all private attributes and consistently use them throughout the project.
  • removes the RDFReader.write method.
  • adds a warning to the ODMLWriter that RDF is not yet supported to avoid crashing later on.
  • unbreaks an install of odML (see RDFWriter broken on install #212) but does not yet fix it.
  • removes leftover code from the xmlparser.
  • removes the unused and obsolete jsonparser; closes Remove jsonparser #219.

Remove usage of "_xml_content" which has already
been removed with PR G-Node#66.
Add file as a first step to disentangle
the various parsers and converters.
First step to remove those pesky
cyclic import errors.
Removes the conversion odML -> python dict
from the ODMLWriter class and uses DictWriter
instead to further the disentanglement of
parser code in this file.
- remove unused code
- use 'with' statement for file handling
@coveralls
Copy link

coveralls commented Jan 25, 2018

Coverage Status

Coverage increased (+2.02%) to 70.468% when pulling ed5d31c on mpsonntag:formatConv into 91eb181 on G-Node:master.

@jgrewe jgrewe merged commit 7c031af into G-Node:master Feb 16, 2018
@mpsonntag mpsonntag deleted the formatConv branch February 20, 2018 14:23
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
4 participants