-
Notifications
You must be signed in to change notification settings - Fork 30
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
phoebe-server style updates #960
base: release-2.5
Are you sure you want to change the base?
Conversation
I ❤️ style improvements! |
I'd like to enforce pep-8 - maybe with extended line length and a few other exceptions - on new PRs (I'll add that to my list to add a check in the CI) and then eventually-eventually work to update the existing codebase (that's just hard to do in one chunk because of all the feature branches and potential conflicts). |
00dab57
to
bf2bf3a
Compare
@@ -584,8 +578,8 @@ def new_bundle(type): | |||
type: 'binary:detached' | |||
""" | |||
j = _get_request(request) | |||
clientid = j.get('clientid', None) if j is not None else None | |||
client_version = j.get('client_version', None) if j is not None else None | |||
#clientid = j.get('clientid', None) if j is not None else None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if adhering to style, then we should add a space after the comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not trying to completely adhere to style (yet), but can make this update
@@ -595,7 +589,8 @@ def new_bundle(type): | |||
b = getattr(phoebe, constructor)(**kwargs) | |||
except Exception as err: | |||
return _get_response({'success': False, 'error': str(err)}, api=True) | |||
if app._debug: raise | |||
if app._debug: | |||
raise |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we be more targeted with this raise?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how so?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
by raising a specific exception?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, this just raises the same exception that triggered the except
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, I'm well aware; I just thought further context might be warranted. But maybe not.
return _get_response({'success': False, 'error': "could not read json data ({})".format(err)}, api=True) | ||
if app._debug: raise | ||
if app._debug: | ||
raise |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
return _get_response({'success': False, 'error': "failed to load bundle with error: "+str(err)}, api=True) | ||
if app._debug: raise | ||
if app._debug: | ||
raise |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
|
||
elif type == 'load:legacy': | ||
try: | ||
b = phoebe.from_legacy(request.files['file']) | ||
except Exception as err: | ||
return _get_response({'success': False, 'error': "file not recognized as bundle or legacy phoebe file. Error: {}".format(str(err))}, api=True) | ||
if app._debug: raise | ||
if app._debug: | ||
raise |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
@@ -760,24 +759,24 @@ def export_script(bundleid): | |||
f.write(log.get_export_script()) | |||
except Exception as err: | |||
f.close() | |||
if app._debug: raise | |||
if app._debug: | |||
raise |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
@app.route('/export_compute/<string:bundleid>/<string:compute>', defaults={'model': None}, methods=['GET', 'POST']) | ||
@app.route('/export_compute/<string:bundleid>/<string:compute>/<string:model>', methods=['GET', 'POST']) | ||
@crossdomain(origin='*') | ||
def export_compute(bundleid, compute, model=None): | ||
""" | ||
""" | ||
j = _get_request(request) | ||
clientid = j.get('clientid', None) if j is not None else None | ||
client_version = j.get('client_version', None) if j is not None else None | ||
#clientid = j.get('clientid', None) if j is not None else None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add space after #
@@ -806,8 +805,8 @@ def export_solver(bundleid, solver, solution=None): | |||
""" | |||
""" | |||
j = _get_request(request) | |||
clientid = j.get('clientid', None) if j is not None else None | |||
client_version = j.get('client_version', None) if j is not None else None | |||
#clientid = j.get('clientid', None) if j is not None else None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add space after #
@@ -835,8 +834,8 @@ def export_params(bundleid, params): | |||
""" | |||
""" | |||
j = _get_request(request) | |||
clientid = j.get('clientid', None) if j is not None else None | |||
client_version = j.get('client_version', None) if j is not None else None | |||
#clientid = j.get('clientid', None) if j is not None else None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
space missing
@app.route('/bundle/<string:bundleid>', methods=['GET', 'POST']) | ||
@crossdomain(origin='*') | ||
def bundle(bundleid): | ||
""" | ||
""" | ||
j = _get_request(request) | ||
clientid = j.get('clientid', None) if j is not None else None | ||
client_version = j.get('client_version', None) if j is not None else None | ||
#clientid = j.get('clientid', None) if j is not None else None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
space missing; I will no longer flag duplicates below for this or for a naked raise
This PR improves style-adherence in phoebe-server