Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

General updates and PEP8 code cleanup #385

Merged
merged 21 commits into from
Apr 22, 2020
Merged

Conversation

mpsonntag
Copy link
Contributor

This large PR adds various updates and general cleanups for simplification and PEP8 compliance.

In detail it

  • adds getter and setter to the odml.Document.origin_file_name attribute. This closes issue [Document] Add '_origin_file_name' accessor methods #358.
  • changes the Exception type in odml.tools.converters.VersionConverter to odml.tools.parser_utils.ParserException. This closes issue [VersionConverter] Specify Exception in 'convert' method #359.
  • adds a new test file test/test_terminology.py and adds a test for the terminology.refresh method.
  • refactors the odml.Property.export_leaf method to also include sibling properties in the export.
  • updates the README to include links to TravisCI an Coveralls
  • updates the tutorial to include descriptions of pprint and the added cardinality feature and adds a link to the templates hosting site.
  • introduces PEP8 code fixes to all files including tests that have not been addressed in previous pull requests.

Closes G-Node#359

Changed plain Exception in '_parse' to
odml.tools.parser_utils.ParserException.
The terminology test was removed since
- the test should not depend on an offsite repository.
- should be in its own file 'test_terminology'.
Refactors the Property.export_leaf method and the
corresponding tests.

When exporting a document from a Property the direct parent
now also exports all Properties and not just the Property
that starts the export.
Reducing the impressive number of pylint warnings; this fixes the
following issues:

- no-else-raise
- consider-using-in
- import-outside-toplevel
- inconsistent-return-statements
- unnecessary-comprehension
This commit fixes the following PEP98 code warnings:

- no-else-return
- no-else-raise
- protected-access (section._merged)
- no-self-use (_convert_value_input -> staticmethod)
This commit fixes the following PEP8 code warnings:

- function-redefined
- no-else-return
- no-else-raise
- inconsistent-return-statements
- no-self-use (staticmethod: _validate_parent)
The terminology refresh test requires a brief sleep
between creating the original file and the refresh
of the same file to receive different mtimes.
On Linux 0.100s is sufficient, macOS requires
a time > 0.700ms.
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.01%) to 76.704% when pulling 76b3f8d on mpsonntag:cleanUpdate into dd29249 on G-Node:master.

Copy link
Member

@jgrewe jgrewe left a comment

Choose a reason for hiding this comment

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

this was a big beast, thanks for the effort


p2 = Property("test", {"name": "Marie", "name": "Johanna"})
self.assertEqual(len(p2), 1)
prop2 = Property("test", {"name": "Marie"})
Copy link
Member

Choose a reason for hiding this comment

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

oh, no, you destroyed the old pun: "Marie Johanna" ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did not even get that one... makes me sad, but I shall be strong and endure it. :p

@jgrewe jgrewe merged commit 206cbba into G-Node:master Apr 22, 2020
@mpsonntag mpsonntag deleted the cleanUpdate branch April 22, 2020 17:43
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.

3 participants