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

Refactoring. #58

Merged
merged 12 commits into from
Aug 7, 2018
Merged

Refactoring. #58

merged 12 commits into from
Aug 7, 2018

Conversation

AndreasAlbert
Copy link
Collaborator

First stab at #57. Any thoughts @clelange?

@AndreasAlbert
Copy link
Collaborator Author

Utility functions now live in helpers subspace. Everything to do with ROOT data formats moved to RootUtils.

@coveralls
Copy link

coveralls commented Aug 2, 2018

Pull Request Test Coverage Report for Build 303

  • 192 of 247 (77.73%) changed or added relevant lines in 3 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.8%) to 74.029%

Changes Missing Coverage Covered Lines Changed/Added Lines %
hepdata_lib/init.py 6 13 46.15%
hepdata_lib/helpers.py 38 49 77.55%
hepdata_lib/root_utils.py 148 185 80.0%
Files with Coverage Reduction New Missed Lines %
hepdata_lib/init.py 1 69.02%
Totals Coverage Status
Change from base Build 283: 0.8%
Covered Lines: 362
Relevant Lines: 489

💛 - Coveralls

@clelange
Copy link
Collaborator

clelange commented Aug 2, 2018

Hi Andreas,

In general, this looks very good to me. I think it's good to abstract away the classes that should not be used by the user to some extent.
Could you reenable the pylint option for the > 1000 lines file?

It's a little bit inconsistent to use CamelCase for RooUtils and then all lower case helpers, use snake_case for both? Then we would have a convention that classes that should be used by the user are CamelCase and the other snake_case?

@AndreasAlbert
Copy link
Collaborator Author

Oh yeah, let's just use snake for both.

Guiding the user with the case convention used in the code is a bit too arcane for my taste.

@AndreasAlbert
Copy link
Collaborator Author

To be more precise:
CamelCase for class names, snake for everything else (which is what we did so far, I think)

@clelange
Copy link
Collaborator

clelange commented Aug 3, 2018

I think there's only one error left:

hepdata_lib/__init__.py:258:12: E0602: Undefined variable 'execute_command' (undefined-variable)

@AndreasAlbert
Copy link
Collaborator Author

  • Fixed pylint errors
  • Applied snake_case to RootUtils submodule -> root_utils
  • Travis now runs pylint on all python sub files

Copy link
Collaborator

@clelange clelange left a comment

Choose a reason for hiding this comment

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

Thanks a lot for this work! Things look good, but one concern: Now that e.g. the RootFileReader isn't a top-level import anymore, access will be broken for all users.
I think we should circumvent that by adding import statements in __init__.py or what is your opinion?
It would probably make sense to have as additional test an example analysis (e.g. one that's already on HEPData) to see if things break for users.

@@ -22,6 +22,8 @@
import numpy as np
Copy link
Collaborator

Choose a reason for hiding this comment

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

We actually don't need the ROOT and numpy imports here anymore, do we?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, removed.

@AndreasAlbert
Copy link
Collaborator Author

You are right about the backward compatibility. For now, I added an import to the main file as per your suggestion. Longer term, we should encourage users to switch their import statements.

@clelange clelange mentioned this pull request Aug 6, 2018
@clelange
Copy link
Collaborator

clelange commented Aug 6, 2018

I'll work on #60 first so that we have a working docker container and binder examples again. Will get to it this week.

@AndreasAlbert
Copy link
Collaborator Author

If #60 is not a code issue on our side, why does this PR need to wait for it?

@clelange clelange mentioned this pull request Aug 7, 2018
@clelange clelange merged commit 6284c56 into master Aug 7, 2018
@clelange clelange deleted the refactoring branch August 7, 2018 20:25
SirVheod pushed a commit to SirVheod/hepdata_lib that referenced this pull request Mar 23, 2020
* Refactoring.
* Fixup import
* Fixup RootFileReader TFile setter logic.
* Fixup import.
* Re-enable pylint warning about number of lines in module.
* Fixup import
* Fixup function call.
* Travis: Run pylint on all hepdata_lib/*.py files.
* Fix pylint errors.
* Rename RootUtils -> root_utils
* Remove unncecessary imports
* Add RootFileReader import for backward compatibility.
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