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

Use rockets python client #587

Merged
merged 2 commits into from
Oct 15, 2018

Conversation

tribal-tec
Copy link
Contributor

No description provided.

from .api_generator import build_api
from .base import BaseClient
from .utils import obtain_registry, convert_snapshot_response_to_PIL, SCHEMA_ENDPOINT
from . import utils
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not move what you have at . in utils?

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually I see that it is there, so why import that one differently? Why not:

from .utils import obtain_registry, convert_snapshot_response_to_PIL, SCHEMA_ENDPOINT, in_notebook

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a trap! The mocking otherwise does not work if the method is not used via its module name.

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it 😄

rolandjitsu
rolandjitsu previously approved these changes Oct 12, 2018
Copy link

@rdumusc rdumusc left a comment

Choose a reason for hiding this comment

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

+1

{
SYNC,
ASYNC
} type{SYNC};
Copy link

Choose a reason for hiding this comment

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

A few things here:

  • I feel that SYNC/ASYNC is somewhat confusing with the way the methods can be used be the client (a SYNC request can still be called in an async fashion by the async client)... What it really tries to say is "standard rpc" / "rpc that can be cancelled with progress report"; although I don't know how to express that succinctly...
  • any reason to use enum instead of enum class?
  • style: I'm not a big fan of this compact notation that's doing two things at once, it's easy to miss the class member hiding here, I'd rather write this in two lines, but that's personal.

};

/** Description for RPC with one parameter. */
struct RpcParameterDescription
struct RpcParameterDescription : public RpcDescription
Copy link

Choose a reason for hiding this comment

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

(public is default for struct)

self.version.patch])
return "Brayns version {0} running on {1}".format(version, self.http_url)

def set_colormap(self, palette, intensity=1, opacity=1, data_range=(0, 256)):
Copy link

Choose a reason for hiding this comment

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

0,256 -> 0,255? Or is the range interpreted as [0,256[ (not included) ?

def function_builder():
"""Wrapper for returning the animation_slider() function."""
def animation_slider():
""".Show slider to control animation"""
Copy link

Choose a reason for hiding this comment

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

. misplaced :-)

schemas))
# pylint: enable=protected-access,cell-var-from-loop
schemas_dict[request.params['endpoint']] = response[0].result
build_api(self, registry, schemas_dict)
Copy link

Choose a reason for hiding this comment

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

code duplicated from AsyncClient? Move to base class?

- add new AsyncClient
- improve code generation
- add more tests
@tribal-tec tribal-tec force-pushed the python_using_rockets branch from 77cd02d to cad051e Compare October 12, 2018 16:15
@tribal-tec
Copy link
Contributor Author

retest this please

@tribal-tec
Copy link
Contributor Author

Need a review again actually

@tribal-tec tribal-tec merged commit 905586a into BlueBrain:master Oct 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants