-
Notifications
You must be signed in to change notification settings - Fork 15
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
Migrate _handler to __init__.py #256
Comments
Maybe not in init, but in a generic subset.py module. |
The It's worth taking a closer look at whether or not we can produce a more generic |
Also, I do agree that having a more generic |
Agree with reducing boilerplate code, but not convinced about the solution proposed. We want the logic of the process to be included in the code, so it's readable. I would rather suggest writing general utilities that are called by the _handler. |
That's a good point. Simplifying the code should not obfuscate the algorithm logic. When you mean wriitng utilities that |
Hum, rather taking code repeated in multiple _handler methods and trying to abstract it in generic functions. |
There was already a discussion about how we can reduce duplication of code. One way we already started is to use the eggshell for shared functionality. There was a discussion on the pywps-dev mailing list started by David. There are also other tickets on this subject: #234 and bird-house/cookiecutter-birdhouse#3 |
I still didn't come up with an example by myself ... but I think Python decorators might also be a way to reduce code duplication. Didn't find a good example, but at least one article: |
@huard reading that thread I would propose to migrate 'subset' module from Flyingpigeon to 'eggshell.nc.subset'. As well moving the corresponding shapefiles from flyingpigen into 'eggshell/data/shapefiles/' |
I'm -1 on this until Finch or Raven actually implement subsetting and decide to use the FP functionality. |
Ok. Great. |
Closing this for now. |
flyingpigeon/flyingpigeon/processes/wps_subset_continents.py
Line 87 in 647019e
For several process 'groups', much of the code is redundant, specifically when it comes to the
_handler
functions. Would it not make more sense to migrate the_handler
s to__init__.py
as empty classes and then build on them using the processes? e.g.I've never seen
super
before but it seems to simply be a class-like function so so long as the_handler
is defined, there should be no problem moving it.The text was updated successfully, but these errors were encountered: