sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
def check_version(): """ Tells you if you have an old version of intern. """ import requests r = requests.get('https://pypi.python.org/pypi/intern/json').json() r = r['info']['version'] if r != __version__: print("You are using version {}. A newer version of intern is available: {} "...
Tells you if you have an old version of intern.
entailment
def check_channel(fcn): """Decorator that ensures a valid channel passed in. Args: fcn (function): Function that has a ChannelResource as its second argument. Returns: (function): Wraps given function with one that checks for a valid channel. """ def wrapper(*args, **kwargs): ...
Decorator that ensures a valid channel passed in. Args: fcn (function): Function that has a ChannelResource as its second argument. Returns: (function): Wraps given function with one that checks for a valid channel.
entailment
def get_cutout(self, resource, resolution, x_range, y_range, z_range, time_range=None, id_list=[], access_mode=CacheMode.no_cache, **kwargs): """Get a cutout from the volume service. Args: resource (intern.resource.boss.resource.ChannelResource): Channel or layer resource. resol...
Get a cutout from the volume service. Args: resource (intern.resource.boss.resource.ChannelResource): Channel or layer resource. resolution (int): 0 indicates native resolution. x_range (list[int]): x range such as [10, 20] which means x>=10 and x<20. y_range (li...
entailment
def reserve_ids(self, resource, num_ids): """Reserve a block of unique, sequential ids for annotations. Args: resource (intern.resource.Resource): Resource should be an annotation channel. num_ids (int): Number of ids to reserve. Returns: (int): First id res...
Reserve a block of unique, sequential ids for annotations. Args: resource (intern.resource.Resource): Resource should be an annotation channel. num_ids (int): Number of ids to reserve. Returns: (int): First id reserved.
entailment
def get_bounding_box(self, resource, resolution, id, bb_type='loose'): """Get bounding box containing object specified by id. Currently only supports 'loose' bounding boxes. The bounding box returned is cuboid aligned. Args: resource (intern.resource.Resource): Resource co...
Get bounding box containing object specified by id. Currently only supports 'loose' bounding boxes. The bounding box returned is cuboid aligned. Args: resource (intern.resource.Resource): Resource compatible with annotation operations. resolution (int): 0 indicates nat...
entailment
def get_ids_in_region( self, resource, resolution, x_range, y_range, z_range, time_range=[0, 1]): """Get all ids in the region defined by x_range, y_range, z_range. Args: resource (intern.resource.Resource): An annotation channel. resolution (int): 0 indi...
Get all ids in the region defined by x_range, y_range, z_range. Args: resource (intern.resource.Resource): An annotation channel. resolution (int): 0 indicates native resolution. x_range (list[int]): x range such as [10, 20] which means x>=10 and x<20. y_range (l...
entailment
def get_neuroglancer_link(self, resource, resolution, x_range, y_range, z_range, **kwargs): """ Get a neuroglancer link of the cutout specified from the host specified in the remote configuration step. Args: resource (intern.resource.Resource): Resource compatible with cutout opera...
Get a neuroglancer link of the cutout specified from the host specified in the remote configuration step. Args: resource (intern.resource.Resource): Resource compatible with cutout operations. resolution (int): 0 indicates native resolution. x_range (list[int]): x range suc...
entailment
def list(self, resource, url_prefix, auth, session, send_opts): """List metadata keys associated with the given resource. Args: resource (intern.resource.boss.BossResource): List keys associated with this resource. url_prefix (string): Protocol + host such as https://api.theboss...
List metadata keys associated with the given resource. Args: resource (intern.resource.boss.BossResource): List keys associated with this resource. url_prefix (string): Protocol + host such as https://api.theboss.io auth (string): Token to send in the request header. ...
entailment
def create(self, resource, keys_vals, url_prefix, auth, session, send_opts): """Create the given key-value pairs for the given resource. Will attempt to create all key-value pairs even if a failure is encountered. Args: resource (intern.resource.boss.BossResource): List keys associ...
Create the given key-value pairs for the given resource. Will attempt to create all key-value pairs even if a failure is encountered. Args: resource (intern.resource.boss.BossResource): List keys associated with this resource. keys_vals (dictionary): The metadata to associate w...
entailment
def get_bit_width(self, resource): """Method to return the bit width for blosc based on the Resource""" datatype = resource.datatype if "uint" in datatype: bit_width = int(datatype.split("uint")[1]) else: raise ValueError("Unsupported datatype: {}".format(datatyp...
Method to return the bit width for blosc based on the Resource
entailment
def create_cutout( self, resource, resolution, x_range, y_range, z_range, time_range, numpyVolume, url_prefix, auth, session, send_opts): """Upload a cutout to the Boss data store. Args: resource (intern.resource.resource.Resource): Resource compatible with cutout operations...
Upload a cutout to the Boss data store. Args: resource (intern.resource.resource.Resource): Resource compatible with cutout operations. resolution (int): 0 indicates native resolution. x_range (list[int]): x range such as [10, 20] which means x>=10 and x<20. y_ra...
entailment
def get_cutout( self, resource, resolution, x_range, y_range, z_range, time_range, id_list, url_prefix, auth, session, send_opts, access_mode=CacheMode.no_cache, **kwargs ): """ Upload a cutout to the Boss data store. Args: resource (intern.resource.r...
Upload a cutout to the Boss data store. Args: resource (intern.resource.resource.Resource): Resource compatible with cutout operations resolution (int): 0 indicates native resolution. x_range (list[int]): x range such as [10, 20] which means x>=10 and x<20. ...
entailment
def reserve_ids( self, resource, num_ids, url_prefix, auth, session, send_opts): """Reserve a block of unique, sequential ids for annotations. Args: resource (intern.resource.Resource): Resource should be an annotation channel. num_ids (int): Number of id...
Reserve a block of unique, sequential ids for annotations. Args: resource (intern.resource.Resource): Resource should be an annotation channel. num_ids (int): Number of ids to reserve. url_prefix (string): Protocol + host such as https://api.theboss.io auth (stri...
entailment
def get_bounding_box( self, resource, resolution, _id, bb_type, url_prefix, auth, session, send_opts): """Get bounding box containing object specified by id. Currently only supports 'loose' bounding boxes. The bounding box returned is cuboid aligned. Args: ...
Get bounding box containing object specified by id. Currently only supports 'loose' bounding boxes. The bounding box returned is cuboid aligned. Args: resource (intern.resource.Resource): Resource compatible with annotation operations. resolution (int): 0 indicates nat...
entailment
def get_ids_in_region( self, resource, resolution, x_range, y_range, z_range, time_range, url_prefix, auth, session, send_opts): """Get all ids in the region defined by x_range, y_range, z_range. Args: resource (intern.resource.Resource): An annotation channel. ...
Get all ids in the region defined by x_range, y_range, z_range. Args: resource (intern.resource.Resource): An annotation channel. resolution (int): 0 indicates native resolution. x_range (list[int]): x range such as [10, 20] which means x>=10 and x<20. y_range (l...
entailment
def get_neuroglancer_link(self, resource, resolution, x_range, y_range, z_range, url_prefix, **kwargs): """ Get a neuroglancer link of the cutout specified from the host specified in the remote configuration step. Args: resource (intern.resource.Resource): Resource compatible with c...
Get a neuroglancer link of the cutout specified from the host specified in the remote configuration step. Args: resource (intern.resource.Resource): Resource compatible with cutout operations. resolution (int): 0 indicates native resolution. x_range (list[int]): x range such...
entailment
def get_graphviz_dot(machine): """ Return the graph of the state machine. The format is the dot format for Graphviz, and can be directly used as input to Graphviz. To learn more about Graphviz, visit https://graphviz.gitlab.io. **Display in Jupyter Notebook** Install Python support for Gr...
Return the graph of the state machine. The format is the dot format for Graphviz, and can be directly used as input to Graphviz. To learn more about Graphviz, visit https://graphviz.gitlab.io. **Display in Jupyter Notebook** Install Python support for Graphviz via `pip install graphviz`. Inst...
entailment
def _parse_arg_list(arglist): """ Parses a list of arguments. Arguments are expected to be split by a comma, surrounded by any amount of whitespace. Arguments are then run through Python's eval() method. """ args = [] for arg in arglist.split(','): arg = arg.strip() if arg: ...
Parses a list of arguments. Arguments are expected to be split by a comma, surrounded by any amount of whitespace. Arguments are then run through Python's eval() method.
entailment
def _parse_action(action): """ Parses a single action item, for instance one of the following: m; m(); m(True); m(*) The brackets must match. """ i_open = action.find('(') if i_open is -1: # return action name, finished return {'name': action, 'args': [], 'event_args': ...
Parses a single action item, for instance one of the following: m; m(); m(True); m(*) The brackets must match.
entailment
def _parse_action_list_attribute(attribute): """ Parses a list of actions, as found in the effect attribute of transitions, and the enry and exit actions of states. Actions are separated by a semicolon, surrounded by any amount of whitespace. A action can have the following form: m; m(); m...
Parses a list of actions, as found in the effect attribute of transitions, and the enry and exit actions of states. Actions are separated by a semicolon, surrounded by any amount of whitespace. A action can have the following form: m; m(); m(True); m(*) The asterisk that the state machine sho...
entailment
def print_status(self): """Provide a snapshot of the current status.""" s = [] s.append('=== State Machines: ===\n') for stm_id in Driver._stms_by_id: stm = Driver._stms_by_id[stm_id] s.append(' - {} in state {}\n'.format(stm.id, stm.state)) s.append('=...
Provide a snapshot of the current status.
entailment
def add_machine(self, machine): """Add the state machine to this driver.""" self._logger.debug('Adding machine {} to driver'.format(machine.id)) machine._driver = self machine._reset() if machine.id is not None: # TODO warning when STM already registered D...
Add the state machine to this driver.
entailment
def start(self, max_transitions=None, keep_active=False): """ Start the driver. This method creates a thread which runs the event loop. The method returns immediately. To wait until the driver finishes, use `stmpy.Driver.wait_until_finished`. `max_transitions`: execute ...
Start the driver. This method creates a thread which runs the event loop. The method returns immediately. To wait until the driver finishes, use `stmpy.Driver.wait_until_finished`. `max_transitions`: execute only this number of transitions, then stop `keep_active`: When true, k...
entailment
def wait_until_finished(self): """Blocking method to wait until the driver finished its execution.""" try: self.thread.join() except KeyboardInterrupt: self._logger.debug('Keyboard interrupt detected, stopping driver.') self._active = False self._w...
Blocking method to wait until the driver finished its execution.
entailment
def _check_timers(self): """ Check for expired timers. If there are any timers that expired, place them in the event queue. """ if self._timer_queue: timer = self._timer_queue[0] if timer['timeout_abs'] < _current_time_millis(): # ...
Check for expired timers. If there are any timers that expired, place them in the event queue.
entailment
def send(self, message_id, stm_id, args=[], kwargs={}): """ Send a message to a state machine handled by this driver. If you have a reference to the state machine, you can also send it directly to it by using `stmpy.Machine.send`. `stm_id` must be the id of a state machine earl...
Send a message to a state machine handled by this driver. If you have a reference to the state machine, you can also send it directly to it by using `stmpy.Machine.send`. `stm_id` must be the id of a state machine earlier added to the driver.
entailment
def start_timer(self, timer_id, timeout): """ Start a timer or restart an active one. The timeout is given in milliseconds. If a timer with the same name already exists, it is restarted with the specified timeout. Note that the timeout is intended as the minimum time until the t...
Start a timer or restart an active one. The timeout is given in milliseconds. If a timer with the same name already exists, it is restarted with the specified timeout. Note that the timeout is intended as the minimum time until the timer's expiration, but may vary due to the state of th...
entailment
def stop_timer(self, timer_id): """ Stop a timer. If the timer is not active, nothing happens. """ self._logger.debug('Stop timer {} in stm {}'.format(timer_id, self.id)) self._driver._stop_timer(timer_id, self)
Stop a timer. If the timer is not active, nothing happens.
entailment
def send(self, message_id, args=[], kwargs={}): """ Send a message to this state machine. To send a message to a state machine by its name, use `stmpy.Driver.send` instead. """ self._logger.debug('Send {} in stm {}'.format(message_id, self.id)) self._driver._add_...
Send a message to this state machine. To send a message to a state machine by its name, use `stmpy.Driver.send` instead.
entailment
def datatype(self, value): """ Args: value (string): 'uint8', 'uint16', 'uint64' Raises: ValueError """ self._datatype = self.validate_datatype(value) self._cutout_ready = True
Args: value (string): 'uint8', 'uint16', 'uint64' Raises: ValueError
entailment
def list(self, resource): """List metadata keys associated with the given resource. Args: resource (intern.resource.boss.BossResource): List keys associated with this resource. Returns: (list): List of key names. Raises: requests.HTTPError on failur...
List metadata keys associated with the given resource. Args: resource (intern.resource.boss.BossResource): List keys associated with this resource. Returns: (list): List of key names. Raises: requests.HTTPError on failure.
entailment
def list_groups(self, filtr=None): """Get the groups the logged in user is a member of. Optionally filter by 'member' or 'maintainer'. Args: filtr (optional[string|None]): ['member'|'maintainer'] or defaults to None. Returns: (list[string]): List of group names....
Get the groups the logged in user is a member of. Optionally filter by 'member' or 'maintainer'. Args: filtr (optional[string|None]): ['member'|'maintainer'] or defaults to None. Returns: (list[string]): List of group names. Raises: requests.HTTPErr...
entailment
def get_group(self, name, user_name=None): """Get owner of group and the resources it's attached to. Args: name (string): Name of group to query. user_name (optional[string]): Supply None if not interested in determining if user is a member of the given group. Returns: ...
Get owner of group and the resources it's attached to. Args: name (string): Name of group to query. user_name (optional[string]): Supply None if not interested in determining if user is a member of the given group. Returns: (dict): Keys include 'owner', 'name', 'res...
entailment
def create_group(self, name): """Create a new group. Args: name (string): Name of the group to create. Raises: requests.HTTPError on failure. """ self.service.create_group( name, self.url_prefix, self.auth, self.session, self.sess...
Create a new group. Args: name (string): Name of the group to create. Raises: requests.HTTPError on failure.
entailment
def delete_group(self, name): """Delete given group. Args: name (string): Name of group. Raises: requests.HTTPError on failure. """ self.service.delete_group( name, self.url_prefix, self.auth, self.session, self.session_send_opts)
Delete given group. Args: name (string): Name of group. Raises: requests.HTTPError on failure.
entailment
def list_group_members(self, name): """Get the members of a group (does not include maintainers). Args: name (string): Name of group to query. Returns: (list[string]): List of member names. Raises: requests.HTTPError on failure. """ ...
Get the members of a group (does not include maintainers). Args: name (string): Name of group to query. Returns: (list[string]): List of member names. Raises: requests.HTTPError on failure.
entailment
def list_group_maintainers(self, name): """Get the maintainers of a group. Args: name (string): Name of group to query. Returns: (list[string]): List of maintainer names. """ return self.service.list_group_maintainers( name, self.url_prefix, ...
Get the maintainers of a group. Args: name (string): Name of group to query. Returns: (list[string]): List of maintainer names.
entailment
def add_group_maintainer(self, name, user): """Add the given user to the named group. Both group and user must already exist for this to succeed. Args: name (string): Name of group. user (string): User to add to group. version (optional[string]): Version of ...
Add the given user to the named group. Both group and user must already exist for this to succeed. Args: name (string): Name of group. user (string): User to add to group. version (optional[string]): Version of the Boss API to use. Defaults to the latest supported ...
entailment
def delete_group_maintainer(self, grp_name, user): """Delete the given user to the named group. Both group and user must already exist for this to succeed. Args: name (string): Name of group. user (string): User to add to group. Raises: requests.HTT...
Delete the given user to the named group. Both group and user must already exist for this to succeed. Args: name (string): Name of group. user (string): User to add to group. Raises: requests.HTTPError on failure.
entailment
def list_permissions(self, group_name=None, resource=None): """List permission sets associated filtering by group and/or resource. Args: group_name (string): Name of group. resource (intern.resource.boss.Resource): Identifies which data model object to operate on. Retur...
List permission sets associated filtering by group and/or resource. Args: group_name (string): Name of group. resource (intern.resource.boss.Resource): Identifies which data model object to operate on. Returns: (list): List of permissions. Raises: ...
entailment
def add_permissions(self, grp_name, resource, permissions): """ Add additional permissions for the group associated with the given resource. Args: grp_name (string): Name of group. resource (intern.resource.boss.BossResource): Identifies which data model object to operate on. ...
Add additional permissions for the group associated with the given resource. Args: grp_name (string): Name of group. resource (intern.resource.boss.BossResource): Identifies which data model object to operate on. permissions (list): List of permissions to add to the given re...
entailment
def delete_permissions(self, grp_name, resource): """Removes permissions from the group for the given resource. Args: grp_name (string): Name of group. resource (intern.resource.boss.BossResource): Identifies which data model object to operate on. Raises: re...
Removes permissions from the group for the given resource. Args: grp_name (string): Name of group. resource (intern.resource.boss.BossResource): Identifies which data model object to operate on. Raises: requests.HTTPError on failure.
entailment
def add_user_role(self, user, role): """Add role to given user. Args: user (string): User name. role (string): Role to assign. Raises: requests.HTTPError on failure. """ self.service.add_user_role( user, role, self.url...
Add role to given user. Args: user (string): User name. role (string): Role to assign. Raises: requests.HTTPError on failure.
entailment
def get_user_roles(self, user): """Get roles associated with the given user. Args: user (string): User name. Returns: (list): List of roles that user has. Raises: requests.HTTPError on failure. """ return self.service.get_user_roles(...
Get roles associated with the given user. Args: user (string): User name. Returns: (list): List of roles that user has. Raises: requests.HTTPError on failure.
entailment
def add_user( self, user, first_name=None, last_name=None, email=None, password=None): """Add a new user. Args: user (string): User name. first_name (optional[string]): User's first name. Defaults to None. last_name (optional[string]): User's last name. Def...
Add a new user. Args: user (string): User name. first_name (optional[string]): User's first name. Defaults to None. last_name (optional[string]): User's last name. Defaults to None. email: (optional[string]): User's email address. Defaults to None. ...
entailment
def get_user(self, user): """Get user's data (first and last name, email, etc). Args: user (string): User name. Returns: (dictionary): User's data encoded in a dictionary. Raises: requests.HTTPError on failure. """ return self.servic...
Get user's data (first and last name, email, etc). Args: user (string): User name. Returns: (dictionary): User's data encoded in a dictionary. Raises: requests.HTTPError on failure.
entailment
def delete_user(self, user): """Delete the given user. Args: user (string): User name. Raises: requests.HTTPError on failure. """ self.service.delete_user( user, self.url_prefix, self.auth, self.session, self.session_send_opts)
Delete the given user. Args: user (string): User name. Raises: requests.HTTPError on failure.
entailment
def create(self, resource): """Create the given resource. Args: resource (intern.resource.boss.BossResource): Create a data model object with attributes matching those of the resource. Returns: (intern.resource.boss.BossResource): Returns resource of type requested on s...
Create the given resource. Args: resource (intern.resource.boss.BossResource): Create a data model object with attributes matching those of the resource. Returns: (intern.resource.boss.BossResource): Returns resource of type requested on success. Raises: re...
entailment
def get(self, resource): """Get attributes of the data model object named by the given resource. Args: resource (intern.resource.boss.BossResource): resource.name as well as any parents must be identified to succeed. Returns: (intern.resource.boss.BossResource): Returns...
Get attributes of the data model object named by the given resource. Args: resource (intern.resource.boss.BossResource): resource.name as well as any parents must be identified to succeed. Returns: (intern.resource.boss.BossResource): Returns resource of type requested on succe...
entailment
def snap_to_cube(q_start, q_stop, chunk_depth=16, q_index=1): """ For any q in {x, y, z, t} Takes in a q-range and returns a 1D bound that starts at a cube boundary and ends at another cube boundary and includes the volume inside the bounds. For instance, snap_to_cube(2, 3) = (1, 17) Arguments:...
For any q in {x, y, z, t} Takes in a q-range and returns a 1D bound that starts at a cube boundary and ends at another cube boundary and includes the volume inside the bounds. For instance, snap_to_cube(2, 3) = (1, 17) Arguments: q_start (int): The lower bound of the q bounding box of volume ...
entailment
def block_compute(x_start, x_stop, y_start, y_stop, z_start, z_stop, origin=(0, 0, 0), block_size=(512, 512, 16)): """ Get bounding box coordinates (in 3D) of small cutouts to request in order to reconstitute a larger cutout. Argum...
Get bounding box coordinates (in 3D) of small cutouts to request in order to reconstitute a larger cutout. Arguments: x_start (int): The lower bound of dimension x x_stop (int): The upper bound of dimension x y_start (int): The lower bound of dimension y y_stop (int): The upper ...
entailment
def _init_project_service(self, version): """ Method to initialize the Project Service from the config data Args: version (string): Version of Boss API to use. Returns: None Raises: (KeyError): if given invalid version. """ p...
Method to initialize the Project Service from the config data Args: version (string): Version of Boss API to use. Returns: None Raises: (KeyError): if given invalid version.
entailment
def _init_metadata_service(self, version): """ Method to initialize the Metadata Service from the config data Args: version (string): Version of Boss API to use. Returns: None Raises: (KeyError): if given invalid version. """ ...
Method to initialize the Metadata Service from the config data Args: version (string): Version of Boss API to use. Returns: None Raises: (KeyError): if given invalid version.
entailment
def _init_volume_service(self, version): """ Method to initialize the Volume Service from the config data Args: version (string): Version of Boss API to use. Returns: None Raises: (KeyError): if given invalid version. """ vol...
Method to initialize the Volume Service from the config data Args: version (string): Version of Boss API to use. Returns: None Raises: (KeyError): if given invalid version.
entailment
def _load_config_section(self, section_name): """ Method to load the specific Service section from the config file if it exists, or fall back to the default Args: section_name (str): The desired service section name Returns: (dict): the section parameter...
Method to load the specific Service section from the config file if it exists, or fall back to the default Args: section_name (str): The desired service section name Returns: (dict): the section parameters
entailment
def list_groups(self, filtr=None): """ Get the groups the logged in user is a member of. Optionally filter by 'member' or 'maintainer'. Args: filtr (optional[string|None]): ['member'|'maintainer'] Returns: (list[string]): List of group names. R...
Get the groups the logged in user is a member of. Optionally filter by 'member' or 'maintainer'. Args: filtr (optional[string|None]): ['member'|'maintainer'] Returns: (list[string]): List of group names. Raises: requests.HTTPError on failure.
entailment
def get_group(self, name, user_name=None): """ Get information on the given group or whether or not a user is a member of the group. Args: name (string): Name of group to query. user_name (optional[string]): Supply None if not interested in determinin...
Get information on the given group or whether or not a user is a member of the group. Args: name (string): Name of group to query. user_name (optional[string]): Supply None if not interested in determining if user is a member of the given group. Returns: ...
entailment
def create_group(self, name): """ Create a new group. Args: name (string): Name of the group to create. Returns: (bool): True on success. Raises: requests.HTTPError on failure. """ self.project_service.set_auth(self._token_pr...
Create a new group. Args: name (string): Name of the group to create. Returns: (bool): True on success. Raises: requests.HTTPError on failure.
entailment
def delete_group(self, name): """ Delete given group. Args: name (string): Name of group. Returns: (bool): True on success. Raises: requests.HTTPError on failure. """ self.project_service.set_auth(self._token_project) ...
Delete given group. Args: name (string): Name of group. Returns: (bool): True on success. Raises: requests.HTTPError on failure.
entailment
def list_group_members(self, name): """ Get the members of a group. Args: name (string): Name of group to query. Returns: (list[string]): List of member names. Raises: requests.HTTPError on failure. """ self.project_service.s...
Get the members of a group. Args: name (string): Name of group to query. Returns: (list[string]): List of member names. Raises: requests.HTTPError on failure.
entailment
def add_group_member(self, grp_name, user): """ Add the given user to the named group. Both group and user must already exist for this to succeed. Args: name (string): Name of group. user_name (string): User to add to group. Raises: requests...
Add the given user to the named group. Both group and user must already exist for this to succeed. Args: name (string): Name of group. user_name (string): User to add to group. Raises: requests.HTTPError on failure.
entailment
def delete_group_member(self, grp_name, user): """ Delete the given user to the named group. Both group and user must already exist for this to succeed. Args: name (string): Name of group. user_name (string): User to delete from the group. Raises: ...
Delete the given user to the named group. Both group and user must already exist for this to succeed. Args: name (string): Name of group. user_name (string): User to delete from the group. Raises: requests.HTTPError on failure.
entailment
def get_is_group_member(self, grp_name, user): """ Check if the given user is a member of the named group. Note that a group maintainer is not considered a member unless the user is also explicitly added as a member. Args: name (string): Name of group. u...
Check if the given user is a member of the named group. Note that a group maintainer is not considered a member unless the user is also explicitly added as a member. Args: name (string): Name of group. user_name (string): User of interest. Returns: ...
entailment
def list_group_maintainers(self, name): """ Get the maintainers of a group. Args: name (string): Name of group to query. Returns: (list[string]): List of maintainer names. Raises: requests.HTTPError on failure. """ self.proje...
Get the maintainers of a group. Args: name (string): Name of group to query. Returns: (list[string]): List of maintainer names. Raises: requests.HTTPError on failure.
entailment
def add_group_maintainer(self, name, user): """ Add the given user to the named group. Both group and user must already exist for this to succeed. Args: name (string): Name of group. user (string): User to add to group. Raises: requests.HTTP...
Add the given user to the named group. Both group and user must already exist for this to succeed. Args: name (string): Name of group. user (string): User to add to group. Raises: requests.HTTPError on failure.
entailment
def delete_group_maintainer(self, grp_name, user): """ Delete the given user to the named group. Both group and user must already exist for this to succeed. Args: name (string): Name of group. user (string): User to add to group. Raises: req...
Delete the given user to the named group. Both group and user must already exist for this to succeed. Args: name (string): Name of group. user (string): User to add to group. Raises: requests.HTTPError on failure.
entailment
def get_is_group_maintainer(self, grp_name, user): """ Check if the given user is a member of the named group. Args: name (string): Name of group. user (string): User of interest. Returns: (bool): False if user not a member. """ self....
Check if the given user is a member of the named group. Args: name (string): Name of group. user (string): User of interest. Returns: (bool): False if user not a member.
entailment
def list_permissions(self, group_name=None, resource=None): """ List permission sets associated filtering by group and/or resource. Args: group_name (string): Name of group. resource (intern.resource.boss.Resource): Identifies which data model object to o...
List permission sets associated filtering by group and/or resource. Args: group_name (string): Name of group. resource (intern.resource.boss.Resource): Identifies which data model object to operate on. Returns: (list): List of permissions. R...
entailment
def get_permissions(self, grp_name, resource): """ Get permissions associated the group has with the given resource. Args: grp_name (string): Name of group. resource (intern.resource.boss.Resource): Identifies which data model object to operate on. ...
Get permissions associated the group has with the given resource. Args: grp_name (string): Name of group. resource (intern.resource.boss.Resource): Identifies which data model object to operate on. Returns: (list): List of permissions. Raise...
entailment
def add_permissions(self, grp_name, resource, permissions): """ Add additional permissions for the group associated with the resource. Args: grp_name (string): Name of group. resource (intern.resource.boss.Resource): Identifies which data model object to ...
Add additional permissions for the group associated with the resource. Args: grp_name (string): Name of group. resource (intern.resource.boss.Resource): Identifies which data model object to operate on. permissions (list): List of permissions to add to the gi...
entailment
def update_permissions(self, grp_name, resource, permissions): """ Update permissions for the group associated with the given resource. Args: grp_name (string): Name of group. resource (intern.resource.boss.Resource): Identifies which data model object to...
Update permissions for the group associated with the given resource. Args: grp_name (string): Name of group. resource (intern.resource.boss.Resource): Identifies which data model object to operate on permissions (list): List of permissions to add to the given...
entailment
def delete_permissions(self, grp_name, resource): """ Removes permissions from the group for the given resource. Args: grp_name (string): Name of group. resource (intern.resource.boss.Resource): Identifies which data model object to operate on. R...
Removes permissions from the group for the given resource. Args: grp_name (string): Name of group. resource (intern.resource.boss.Resource): Identifies which data model object to operate on. Raises: requests.HTTPError on failure.
entailment
def get_user_roles(self, user): """ Get roles associated with the given user. Args: user (string): User name. Returns: (list): List of roles that user has. Raises: requests.HTTPError on failure. """ self.project_service.set_a...
Get roles associated with the given user. Args: user (string): User name. Returns: (list): List of roles that user has. Raises: requests.HTTPError on failure.
entailment
def add_user_role(self, user, role): """ Add role to given user. Args: user (string): User name. role (string): Role to assign. Raises: requests.HTTPError on failure. """ self.project_service.set_auth(self._token_project) self...
Add role to given user. Args: user (string): User name. role (string): Role to assign. Raises: requests.HTTPError on failure.
entailment
def delete_user_role(self, user, role): """ Remove role from given user. Args: user (string): User name. role (string): Role to remove. Raises: requests.HTTPError on failure. """ self.project_service.set_auth(self._token_project) ...
Remove role from given user. Args: user (string): User name. role (string): Role to remove. Raises: requests.HTTPError on failure.
entailment
def get_user(self, user): """ Get user's data (first and last name, email, etc). Args: user (string): User name. Returns: (dictionary): User's data encoded in a dictionary. Raises: requests.HTTPError on failure. """ self.proj...
Get user's data (first and last name, email, etc). Args: user (string): User name. Returns: (dictionary): User's data encoded in a dictionary. Raises: requests.HTTPError on failure.
entailment
def get_user_groups(self, user): """ Get user's group memberships. Args: user (string): User name. Returns: (list): User's groups. Raises: requests.HTTPError on failure. """ self.project_service.set_auth(self._token_project) ...
Get user's group memberships. Args: user (string): User name. Returns: (list): User's groups. Raises: requests.HTTPError on failure.
entailment
def add_user( self, user, first_name=None, last_name=None, email=None, password=None ): """ Add a new user. Args: user (string): User name. first_name (optional[string]): User's first name. Defaults to None. last_n...
Add a new user. Args: user (string): User name. first_name (optional[string]): User's first name. Defaults to None. last_name (optional[string]): User's last name. Defaults to None. email: (optional[string]): User's email address. Defaults to None. ...
entailment
def delete_user(self, user): """ Delete the given user. Args: user (string): User name. Raises: requests.HTTPError on failure. """ self.project_service.set_auth(self._token_project) self.project_service.delete_user(user)
Delete the given user. Args: user (string): User name. Raises: requests.HTTPError on failure.
entailment
def _list_resource(self, resource): """ List all instances of the given resource type. Use the specific list_<resource>() methods instead: list_collections() list_experiments() list_channels() list_coordinate_frames() Args: re...
List all instances of the given resource type. Use the specific list_<resource>() methods instead: list_collections() list_experiments() list_channels() list_coordinate_frames() Args: resource (intern.resource.boss.BossResource): resource.nam...
entailment
def list_experiments(self, collection_name): """ List all experiments that belong to a collection. Args: collection_name (string): Name of the parent collection. Returns: (list) Raises: requests.HTTPError on failure. """ exp ...
List all experiments that belong to a collection. Args: collection_name (string): Name of the parent collection. Returns: (list) Raises: requests.HTTPError on failure.
entailment
def list_channels(self, collection_name, experiment_name): """ List all channels belonging to the named experiment that is part of the named collection. Args: collection_name (string): Name of the parent collection. experiment_name (string): Name of the parent ex...
List all channels belonging to the named experiment that is part of the named collection. Args: collection_name (string): Name of the parent collection. experiment_name (string): Name of the parent experiment. Returns: (list) Raises: req...
entailment
def get_channel(self, chan_name, coll_name, exp_name): """ Helper that gets a fully initialized ChannelResource for an *existing* channel. Args: chan_name (str): Name of channel. coll_name (str): Name of channel's collection. exp_name (str): Name of channel's...
Helper that gets a fully initialized ChannelResource for an *existing* channel. Args: chan_name (str): Name of channel. coll_name (str): Name of channel's collection. exp_name (str): Name of channel's experiment. Returns: (intern.resource.boss.ChannelRes...
entailment
def create_project(self, resource): """ Create the entity described by the given resource. Args: resource (intern.resource.boss.BossResource) Returns: (intern.resource.boss.BossResource): Returns resource of type requested on success. Ra...
Create the entity described by the given resource. Args: resource (intern.resource.boss.BossResource) Returns: (intern.resource.boss.BossResource): Returns resource of type requested on success. Raises: requests.HTTPError on failure.
entailment
def get_project(self, resource): """ Get attributes of the data model object named by the given resource. Args: resource (intern.resource.boss.BossResource): resource.name as well as any parents must be identified to succeed. Returns: (intern.res...
Get attributes of the data model object named by the given resource. Args: resource (intern.resource.boss.BossResource): resource.name as well as any parents must be identified to succeed. Returns: (intern.resource.boss.BossResource): Returns resource of type ...
entailment
def update_project(self, resource_name, resource): """ Updates an entity in the data model using the given resource. Args: resource_name (string): Current name of the resource (in case the resource is getting its name changed). resource (intern.resource.b...
Updates an entity in the data model using the given resource. Args: resource_name (string): Current name of the resource (in case the resource is getting its name changed). resource (intern.resource.boss.BossResource): New attributes for the resource. ...
entailment
def delete_project(self, resource): """ Deletes the entity described by the given resource. Args: resource (intern.resource.boss.BossResource) Raises: requests.HTTPError on a failure. """ self.project_service.set_auth(self._token_project) ...
Deletes the entity described by the given resource. Args: resource (intern.resource.boss.BossResource) Raises: requests.HTTPError on a failure.
entailment
def list_metadata(self, resource): """ List all keys associated with the given resource. Args: resource (intern.resource.boss.BossResource) Returns: (list) Raises: requests.HTTPError on a failure. """ self.metadata_service.se...
List all keys associated with the given resource. Args: resource (intern.resource.boss.BossResource) Returns: (list) Raises: requests.HTTPError on a failure.
entailment
def create_metadata(self, resource, keys_vals): """ Associates new key-value pairs with the given resource. Will attempt to add all key-value pairs even if some fail. Args: resource (intern.resource.boss.BossResource) keys_vals (dictionary): Collection of key-va...
Associates new key-value pairs with the given resource. Will attempt to add all key-value pairs even if some fail. Args: resource (intern.resource.boss.BossResource) keys_vals (dictionary): Collection of key-value pairs to assign to given resource. Rais...
entailment
def get_metadata(self, resource, keys): """ Gets the values for given keys associated with the given resource. Args: resource (intern.resource.boss.BossResource) keys (list) Returns: (dictionary) Raises: HTTPErrorList on failure....
Gets the values for given keys associated with the given resource. Args: resource (intern.resource.boss.BossResource) keys (list) Returns: (dictionary) Raises: HTTPErrorList on failure.
entailment
def update_metadata(self, resource, keys_vals): """ Updates key-value pairs with the given resource. Will attempt to update all key-value pairs even if some fail. Keys must already exist. Args: resource (intern.resource.boss.BossResource) keys_vals (dict...
Updates key-value pairs with the given resource. Will attempt to update all key-value pairs even if some fail. Keys must already exist. Args: resource (intern.resource.boss.BossResource) keys_vals (dictionary): Collection of key-value pairs to update on ...
entailment
def delete_metadata(self, resource, keys): """ Deletes the given key-value pairs associated with the given resource. Will attempt to delete all key-value pairs even if some fail. Args: resource (intern.resource.boss.BossResource) keys (list) Raises: ...
Deletes the given key-value pairs associated with the given resource. Will attempt to delete all key-value pairs even if some fail. Args: resource (intern.resource.boss.BossResource) keys (list) Raises: HTTPErrorList on failure.
entailment
def parse_bossURI(self, uri): # type: (str) -> Resource """ Parse a bossDB URI and handle malform errors. Arguments: uri (str): URI of the form bossdb://<collection>/<experiment>/<channel> Returns: Resource """ t = uri.split("://")[1].split("/")...
Parse a bossDB URI and handle malform errors. Arguments: uri (str): URI of the form bossdb://<collection>/<experiment>/<channel> Returns: Resource
entailment
def get_cutout(self, resource, resolution, x_range, y_range, z_range, time_range=None, id_list=[], no_cache=None, access_mode=CacheMode.no_cache, **kwargs): """Get a cutout from the volume service. Note that access_mode=no_cache is desirable when reading large amounts of data at onc...
Get a cutout from the volume service. Note that access_mode=no_cache is desirable when reading large amounts of data at once. In these cases, the data is not first read into the cache, but instead, is sent directly from the data store to the requester. Args...
entailment
def get_experiment(self, coll_name, exp_name): """ Convenience method that gets experiment resource. Args: coll_name (str): Collection name exp_name (str): Experiment name Returns: (ExperimentResource) """ exp = ExperimentReso...
Convenience method that gets experiment resource. Args: coll_name (str): Collection name exp_name (str): Experiment name Returns: (ExperimentResource)
entailment
def get_neuroglancer_link(self, resource, resolution, x_range, y_range, z_range, **kwargs): """ Get a neuroglancer link of the cutout specified from the host specified in the remote configuration step. Args: resource (intern.resource.Resource): Resource compatible w...
Get a neuroglancer link of the cutout specified from the host specified in the remote configuration step. Args: resource (intern.resource.Resource): Resource compatible with cutout operations. resolution (int): 0 indicates native resolution. x_range (list[in...
entailment
def views(model: "Model") -> list: """Return a model's views keyed on what events they respond to. Model views are added by calling :func:`view` on a model. """ if not isinstance(model, Model): raise TypeError("Expected a Model, not %r." % model) return model._model_views[:]
Return a model's views keyed on what events they respond to. Model views are added by calling :func:`view` on a model.
entailment
def view(model: "Model", *functions: Callable) -> Optional[Callable]: """A decorator for registering a callback to a model Parameters: model: the model object whose changes the callback should respond to. Examples: .. code-block:: python from spectate import mvc i...
A decorator for registering a callback to a model Parameters: model: the model object whose changes the callback should respond to. Examples: .. code-block:: python from spectate import mvc items = mvc.List() @mvc.view(items) def printer(items...
entailment
def before(self, callback: Union[Callable, str]) -> "Control": """Register a control method that reacts before the trigger method is called. Parameters: callback: The control method. If given as a callable, then that function will be used as the callback. If ...
Register a control method that reacts before the trigger method is called. Parameters: callback: The control method. If given as a callable, then that function will be used as the callback. If given as a string, then the control will look up a method ...
entailment
def after(self, callback: Union[Callable, str]) -> "Control": """Register a control method that reacts after the trigger method is called. Parameters: callback: The control method. If given as a callable, then that function will be used as the callback. If gi...
Register a control method that reacts after the trigger method is called. Parameters: callback: The control method. If given as a callable, then that function will be used as the callback. If given as a string, then the control will look up a method w...
entailment