repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
falkr/stmpy
stmpy/__init__.py
Driver.start
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 ...
python
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 ...
[ "def", "start", "(", "self", ",", "max_transitions", "=", "None", ",", "keep_active", "=", "False", ")", ":", "self", ".", "_active", "=", "True", "self", ".", "_max_transitions", "=", "max_transitions", "self", ".", "_keep_active", "=", "keep_active", "self...
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...
[ "Start", "the", "driver", "." ]
train
https://github.com/falkr/stmpy/blob/78b016f7bf6fa7b6eba8dae58997fb99f7215bf7/stmpy/__init__.py#L272-L288
falkr/stmpy
stmpy/__init__.py
Driver.wait_until_finished
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...
python
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...
[ "def", "wait_until_finished", "(", "self", ")", ":", "try", ":", "self", ".", "thread", ".", "join", "(", ")", "except", "KeyboardInterrupt", ":", "self", ".", "_logger", ".", "debug", "(", "'Keyboard interrupt detected, stopping driver.'", ")", "self", ".", "...
Blocking method to wait until the driver finished its execution.
[ "Blocking", "method", "to", "wait", "until", "the", "driver", "finished", "its", "execution", "." ]
train
https://github.com/falkr/stmpy/blob/78b016f7bf6fa7b6eba8dae58997fb99f7215bf7/stmpy/__init__.py#L300-L307
falkr/stmpy
stmpy/__init__.py
Driver._check_timers
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(): # ...
python
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(): # ...
[ "def", "_check_timers", "(", "self", ")", ":", "if", "self", ".", "_timer_queue", ":", "timer", "=", "self", ".", "_timer_queue", "[", "0", "]", "if", "timer", "[", "'timeout_abs'", "]", "<", "_current_time_millis", "(", ")", ":", "# the timer is expired, re...
Check for expired timers. If there are any timers that expired, place them in the event queue.
[ "Check", "for", "expired", "timers", "." ]
train
https://github.com/falkr/stmpy/blob/78b016f7bf6fa7b6eba8dae58997fb99f7215bf7/stmpy/__init__.py#L344-L367
falkr/stmpy
stmpy/__init__.py
Driver.send
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...
python
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...
[ "def", "send", "(", "self", ",", "message_id", ",", "stm_id", ",", "args", "=", "[", "]", ",", "kwargs", "=", "{", "}", ")", ":", "if", "stm_id", "not", "in", "Driver", ".", "_stms_by_id", ":", "self", ".", "_logger", ".", "warn", "(", "'Machine wi...
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.
[ "Send", "a", "message", "to", "a", "state", "machine", "handled", "by", "this", "driver", "." ]
train
https://github.com/falkr/stmpy/blob/78b016f7bf6fa7b6eba8dae58997fb99f7215bf7/stmpy/__init__.py#L375-L389
falkr/stmpy
stmpy/__init__.py
Machine.start_timer
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...
python
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...
[ "def", "start_timer", "(", "self", ",", "timer_id", ",", "timeout", ")", ":", "self", ".", "_logger", ".", "debug", "(", "'Start timer {} in stm {}'.", "f", "ormat(", "t", "imer_id,", " ", "elf.", "i", "d)", ")", "", "self", ".", "_driver", ".", "_start_...
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...
[ "Start", "a", "timer", "or", "restart", "an", "active", "one", "." ]
train
https://github.com/falkr/stmpy/blob/78b016f7bf6fa7b6eba8dae58997fb99f7215bf7/stmpy/__init__.py#L763-L774
falkr/stmpy
stmpy/__init__.py
Machine.stop_timer
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)
python
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)
[ "def", "stop_timer", "(", "self", ",", "timer_id", ")", ":", "self", ".", "_logger", ".", "debug", "(", "'Stop timer {} in stm {}'.", "f", "ormat(", "t", "imer_id,", " ", "elf.", "i", "d)", ")", "", "self", ".", "_driver", ".", "_stop_timer", "(", "timer...
Stop a timer. If the timer is not active, nothing happens.
[ "Stop", "a", "timer", "." ]
train
https://github.com/falkr/stmpy/blob/78b016f7bf6fa7b6eba8dae58997fb99f7215bf7/stmpy/__init__.py#L776-L783
falkr/stmpy
stmpy/__init__.py
Machine.send
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_...
python
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_...
[ "def", "send", "(", "self", ",", "message_id", ",", "args", "=", "[", "]", ",", "kwargs", "=", "{", "}", ")", ":", "self", ".", "_logger", ".", "debug", "(", "'Send {} in stm {}'.", "f", "ormat(", "m", "essage_id,", " ", "elf.", "i", "d)", ")", "",...
Send a message to this state machine. To send a message to a state machine by its name, use `stmpy.Driver.send` instead.
[ "Send", "a", "message", "to", "this", "state", "machine", "." ]
train
https://github.com/falkr/stmpy/blob/78b016f7bf6fa7b6eba8dae58997fb99f7215bf7/stmpy/__init__.py#L793-L802
jhuapl-boss/intern
intern/resource/boss/resource.py
ChannelResource.datatype
def datatype(self, value): """ Args: value (string): 'uint8', 'uint16', 'uint64' Raises: ValueError """ self._datatype = self.validate_datatype(value) self._cutout_ready = True
python
def datatype(self, value): """ Args: value (string): 'uint8', 'uint16', 'uint64' Raises: ValueError """ self._datatype = self.validate_datatype(value) self._cutout_ready = True
[ "def", "datatype", "(", "self", ",", "value", ")", ":", "self", ".", "_datatype", "=", "self", ".", "validate_datatype", "(", "value", ")", "self", ".", "_cutout_ready", "=", "True" ]
Args: value (string): 'uint8', 'uint16', 'uint64' Raises: ValueError
[ "Args", ":", "value", "(", "string", ")", ":", "uint8", "uint16", "uint64", "Raises", ":", "ValueError" ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/resource/boss/resource.py#L562-L570
jhuapl-boss/intern
intern/service/boss/metadata.py
MetadataService.list
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...
python
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...
[ "def", "list", "(", "self", ",", "resource", ")", ":", "return", "self", ".", "service", ".", "list", "(", "resource", ",", "self", ".", "url_prefix", ",", "self", ".", "auth", ",", "self", ".", "session", ",", "self", ".", "session_send_opts", ")" ]
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.
[ "List", "metadata", "keys", "associated", "with", "the", "given", "resource", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/metadata.py#L40-L54
jhuapl-boss/intern
intern/service/boss/project.py
ProjectService.list_groups
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....
python
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....
[ "def", "list_groups", "(", "self", ",", "filtr", "=", "None", ")", ":", "return", "self", ".", "service", ".", "list_groups", "(", "filtr", ",", "self", ".", "url_prefix", ",", "self", ".", "auth", ",", "self", ".", "session", ",", "self", ".", "sess...
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...
[ "Get", "the", "groups", "the", "logged", "in", "user", "is", "a", "member", "of", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/project.py#L40-L55
jhuapl-boss/intern
intern/service/boss/project.py
ProjectService.get_group
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: ...
python
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: ...
[ "def", "get_group", "(", "self", ",", "name", ",", "user_name", "=", "None", ")", ":", "return", "self", ".", "service", ".", "get_group", "(", "name", ",", "user_name", ",", "self", ".", "url_prefix", ",", "self", ".", "auth", ",", "self", ".", "ses...
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...
[ "Get", "owner", "of", "group", "and", "the", "resources", "it", "s", "attached", "to", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/project.py#L57-L72
jhuapl-boss/intern
intern/service/boss/project.py
ProjectService.create_group
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...
python
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...
[ "def", "create_group", "(", "self", ",", "name", ")", ":", "self", ".", "service", ".", "create_group", "(", "name", ",", "self", ".", "url_prefix", ",", "self", ".", "auth", ",", "self", ".", "session", ",", "self", ".", "session_send_opts", ")" ]
Create a new group. Args: name (string): Name of the group to create. Raises: requests.HTTPError on failure.
[ "Create", "a", "new", "group", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/project.py#L74-L85
jhuapl-boss/intern
intern/service/boss/project.py
ProjectService.delete_group
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)
python
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)
[ "def", "delete_group", "(", "self", ",", "name", ")", ":", "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.
[ "Delete", "given", "group", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/project.py#L87-L98
jhuapl-boss/intern
intern/service/boss/project.py
ProjectService.list_group_members
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. """ ...
python
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. """ ...
[ "def", "list_group_members", "(", "self", ",", "name", ")", ":", "return", "self", ".", "service", ".", "list_group_members", "(", "name", ",", "self", ".", "url_prefix", ",", "self", ".", "auth", ",", "self", ".", "session", ",", "self", ".", "session_s...
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", ")", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/project.py#L100-L114
jhuapl-boss/intern
intern/service/boss/project.py
ProjectService.list_group_maintainers
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, ...
python
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, ...
[ "def", "list_group_maintainers", "(", "self", ",", "name", ")", ":", "return", "self", ".", "service", ".", "list_group_maintainers", "(", "name", ",", "self", ".", "url_prefix", ",", "self", ".", "auth", ",", "self", ".", "session", ",", "self", ".", "s...
Get the maintainers of a group. Args: name (string): Name of group to query. Returns: (list[string]): List of maintainer names.
[ "Get", "the", "maintainers", "of", "a", "group", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/project.py#L163-L174
jhuapl-boss/intern
intern/service/boss/project.py
ProjectService.add_group_maintainer
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 ...
python
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 ...
[ "def", "add_group_maintainer", "(", "self", ",", "name", ",", "user", ")", ":", "self", ".", "service", ".", "add_group_maintainer", "(", "name", ",", "user", ",", "self", ".", "url_prefix", ",", "self", ".", "auth", ",", "self", ".", "session", ",", "...
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 ...
[ "Add", "the", "given", "user", "to", "the", "named", "group", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/project.py#L176-L191
jhuapl-boss/intern
intern/service/boss/project.py
ProjectService.delete_group_maintainer
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...
python
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...
[ "def", "delete_group_maintainer", "(", "self", ",", "grp_name", ",", "user", ")", ":", "self", ".", "service", ".", "delete_group_maintainer", "(", "grp_name", ",", "user", ",", "self", ".", "url_prefix", ",", "self", ".", "auth", ",", "self", ".", "sessio...
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.
[ "Delete", "the", "given", "user", "to", "the", "named", "group", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/project.py#L193-L207
jhuapl-boss/intern
intern/service/boss/project.py
ProjectService.list_permissions
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...
python
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...
[ "def", "list_permissions", "(", "self", ",", "group_name", "=", "None", ",", "resource", "=", "None", ")", ":", "return", "self", ".", "service", ".", "list_permissions", "(", "group_name", ",", "resource", ",", "self", ".", "url_prefix", ",", "self", ".",...
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: ...
[ "List", "permission", "sets", "associated", "filtering", "by", "group", "and", "/", "or", "resource", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/project.py#L223-L237
jhuapl-boss/intern
intern/service/boss/project.py
ProjectService.add_permissions
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. ...
python
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. ...
[ "def", "add_permissions", "(", "self", ",", "grp_name", ",", "resource", ",", "permissions", ")", ":", "self", ".", "service", ".", "add_permissions", "(", "grp_name", ",", "resource", ",", "permissions", ",", "self", ".", "url_prefix", ",", "self", ".", "...
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...
[ "Add", "additional", "permissions", "for", "the", "group", "associated", "with", "the", "given", "resource", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/project.py#L257-L270
jhuapl-boss/intern
intern/service/boss/project.py
ProjectService.delete_permissions
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...
python
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...
[ "def", "delete_permissions", "(", "self", ",", "grp_name", ",", "resource", ")", ":", "self", ".", "service", ".", "delete_permissions", "(", "grp_name", ",", "resource", ",", "self", ".", "url_prefix", ",", "self", ".", "auth", ",", "self", ".", "session"...
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.
[ "Removes", "permissions", "from", "the", "group", "for", "the", "given", "resource", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/project.py#L287-L298
jhuapl-boss/intern
intern/service/boss/project.py
ProjectService.add_user_role
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...
python
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...
[ "def", "add_user_role", "(", "self", ",", "user", ",", "role", ")", ":", "self", ".", "service", ".", "add_user_role", "(", "user", ",", "role", ",", "self", ".", "url_prefix", ",", "self", ".", "auth", ",", "self", ".", "session", ",", "self", ".", ...
Add role to given user. Args: user (string): User name. role (string): Role to assign. Raises: requests.HTTPError on failure.
[ "Add", "role", "to", "given", "user", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/project.py#L300-L312
jhuapl-boss/intern
intern/service/boss/project.py
ProjectService.get_user_roles
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(...
python
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(...
[ "def", "get_user_roles", "(", "self", ",", "user", ")", ":", "return", "self", ".", "service", ".", "get_user_roles", "(", "user", ",", "self", ".", "url_prefix", ",", "self", ".", "auth", ",", "self", ".", "session", ",", "self", ".", "session_send_opts...
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.
[ "Get", "roles", "associated", "with", "the", "given", "user", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/project.py#L328-L341
jhuapl-boss/intern
intern/service/boss/project.py
ProjectService.add_user
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...
python
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...
[ "def", "add_user", "(", "self", ",", "user", ",", "first_name", "=", "None", ",", "last_name", "=", "None", ",", "email", "=", "None", ",", "password", "=", "None", ")", ":", "self", ".", "service", ".", "add_user", "(", "user", ",", "first_name", ",...
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. ...
[ "Add", "a", "new", "user", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/project.py#L343-L359
jhuapl-boss/intern
intern/service/boss/project.py
ProjectService.get_user
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...
python
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...
[ "def", "get_user", "(", "self", ",", "user", ")", ":", "return", "self", ".", "service", ".", "get_user", "(", "user", ",", "self", ".", "url_prefix", ",", "self", ".", "auth", ",", "self", ".", "session", ",", "self", ".", "session_send_opts", ")" ]
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.
[ "Get", "user", "s", "data", "(", "first", "and", "last", "name", "email", "etc", ")", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/project.py#L361-L374
jhuapl-boss/intern
intern/service/boss/project.py
ProjectService.delete_user
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)
python
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)
[ "def", "delete_user", "(", "self", ",", "user", ")", ":", "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.
[ "Delete", "the", "given", "user", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/project.py#L376-L386
jhuapl-boss/intern
intern/service/boss/project.py
ProjectService.create
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...
python
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...
[ "def", "create", "(", "self", ",", "resource", ")", ":", "return", "self", ".", "service", ".", "create", "(", "resource", ",", "self", ".", "url_prefix", ",", "self", ".", "auth", ",", "self", ".", "session", ",", "self", ".", "session_send_opts", ")"...
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...
[ "Create", "the", "given", "resource", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/project.py#L404-L418
jhuapl-boss/intern
intern/service/boss/project.py
ProjectService.get
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...
python
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...
[ "def", "get", "(", "self", ",", "resource", ")", ":", "return", "self", ".", "service", ".", "get", "(", "resource", ",", "self", ".", "url_prefix", ",", "self", ".", "auth", ",", "self", ".", "session", ",", "self", ".", "session_send_opts", ")" ]
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...
[ "Get", "attributes", "of", "the", "data", "model", "object", "named", "by", "the", "given", "resource", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/project.py#L420-L434
jhuapl-boss/intern
intern/utils/parallel.py
snap_to_cube
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:...
python
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:...
[ "def", "snap_to_cube", "(", "q_start", ",", "q_stop", ",", "chunk_depth", "=", "16", ",", "q_index", "=", "1", ")", ":", "lo", "=", "0", "hi", "=", "0", "# Start by indexing everything at zero for our own sanity", "q_start", "-=", "q_index", "q_stop", "-=", "q...
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 ...
[ "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", "include...
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/utils/parallel.py#L21-L54
jhuapl-boss/intern
intern/utils/parallel.py
block_compute
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...
python
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...
[ "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. 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 ...
[ "Get", "bounding", "box", "coordinates", "(", "in", "3D", ")", "of", "small", "cutouts", "to", "request", "in", "order", "to", "reconstitute", "a", "larger", "cutout", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/utils/parallel.py#L57-L126
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote._init_project_service
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...
python
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...
[ "def", "_init_project_service", "(", "self", ",", "version", ")", ":", "project_cfg", "=", "self", ".", "_load_config_section", "(", "CONFIG_PROJECT_SECTION", ")", "self", ".", "_token_project", "=", "project_cfg", "[", "CONFIG_TOKEN", "]", "proto", "=", "project_...
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.
[ "Method", "to", "initialize", "the", "Project", "Service", "from", "the", "config", "data" ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L83-L103
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote._init_metadata_service
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. """ ...
python
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. """ ...
[ "def", "_init_metadata_service", "(", "self", ",", "version", ")", ":", "metadata_cfg", "=", "self", ".", "_load_config_section", "(", "CONFIG_METADATA_SECTION", ")", "self", ".", "_token_metadata", "=", "metadata_cfg", "[", "CONFIG_TOKEN", "]", "proto", "=", "met...
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" ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L105-L125
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote._init_volume_service
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...
python
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...
[ "def", "_init_volume_service", "(", "self", ",", "version", ")", ":", "volume_cfg", "=", "self", ".", "_load_config_section", "(", "CONFIG_VOLUME_SECTION", ")", "self", ".", "_token_volume", "=", "volume_cfg", "[", "CONFIG_TOKEN", "]", "proto", "=", "volume_cfg", ...
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.
[ "Method", "to", "initialize", "the", "Volume", "Service", "from", "the", "config", "data" ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L127-L147
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote._load_config_section
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...
python
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...
[ "def", "_load_config_section", "(", "self", ",", "section_name", ")", ":", "if", "self", ".", "_config", ".", "has_section", "(", "section_name", ")", ":", "# Load specific section", "section", "=", "dict", "(", "self", ".", "_config", ".", "items", "(", "se...
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
[ "Method", "to", "load", "the", "specific", "Service", "section", "from", "the", "config", "file", "if", "it", "exists", "or", "fall", "back", "to", "the", "default" ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L149-L179
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.list_groups
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...
python
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...
[ "def", "list_groups", "(", "self", ",", "filtr", "=", "None", ")", ":", "self", ".", "project_service", ".", "set_auth", "(", "self", ".", "_token_project", ")", "return", "self", ".", "project_service", ".", "list_groups", "(", "filtr", ")" ]
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.
[ "Get", "the", "groups", "the", "logged", "in", "user", "is", "a", "member", "of", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L217-L233
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.get_group
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...
python
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...
[ "def", "get_group", "(", "self", ",", "name", ",", "user_name", "=", "None", ")", ":", "self", ".", "project_service", ".", "set_auth", "(", "self", ".", "_token_project", ")", "return", "self", ".", "project_service", ".", "get_group", "(", "name", ",", ...
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: ...
[ "Get", "information", "on", "the", "given", "group", "or", "whether", "or", "not", "a", "user", "is", "a", "member", "of", "the", "group", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L235-L253
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.create_group
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...
python
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...
[ "def", "create_group", "(", "self", ",", "name", ")", ":", "self", ".", "project_service", ".", "set_auth", "(", "self", ".", "_token_project", ")", "return", "self", ".", "project_service", ".", "create_group", "(", "name", ")" ]
Create a new group. Args: name (string): Name of the group to create. Returns: (bool): True on success. Raises: requests.HTTPError on failure.
[ "Create", "a", "new", "group", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L255-L269
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.delete_group
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) ...
python
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) ...
[ "def", "delete_group", "(", "self", ",", "name", ")", ":", "self", ".", "project_service", ".", "set_auth", "(", "self", ".", "_token_project", ")", "return", "self", ".", "project_service", ".", "delete_group", "(", "name", ")" ]
Delete given group. Args: name (string): Name of group. Returns: (bool): True on success. Raises: requests.HTTPError on failure.
[ "Delete", "given", "group", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L271-L285
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.list_group_members
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...
python
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...
[ "def", "list_group_members", "(", "self", ",", "name", ")", ":", "self", ".", "project_service", ".", "set_auth", "(", "self", ".", "_token_project", ")", "return", "self", ".", "project_service", ".", "list_group_members", "(", "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.
[ "Get", "the", "members", "of", "a", "group", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L287-L301
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.add_group_member
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...
python
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...
[ "def", "add_group_member", "(", "self", ",", "grp_name", ",", "user", ")", ":", "self", ".", "project_service", ".", "set_auth", "(", "self", ".", "_token_project", ")", "self", ".", "project_service", ".", "add_group_member", "(", "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.HTTPError on failure.
[ "Add", "the", "given", "user", "to", "the", "named", "group", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L303-L317
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.delete_group_member
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: ...
python
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: ...
[ "def", "delete_group_member", "(", "self", ",", "grp_name", ",", "user", ")", ":", "self", ".", "project_service", ".", "set_auth", "(", "self", ".", "_token_project", ")", "self", ".", "project_service", ".", "delete_group_member", "(", "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: requests.HTTPError on failure.
[ "Delete", "the", "given", "user", "to", "the", "named", "group", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L319-L333
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.get_is_group_member
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...
python
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...
[ "def", "get_is_group_member", "(", "self", ",", "grp_name", ",", "user", ")", ":", "self", ".", "project_service", ".", "set_auth", "(", "self", ".", "_token_project", ")", "return", "self", ".", "project_service", ".", "get_is_group_member", "(", "grp_name", ...
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: ...
[ "Check", "if", "the", "given", "user", "is", "a", "member", "of", "the", "named", "group", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L335-L350
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.list_group_maintainers
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...
python
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...
[ "def", "list_group_maintainers", "(", "self", ",", "name", ")", ":", "self", ".", "project_service", ".", "set_auth", "(", "self", ".", "_token_project", ")", "return", "self", ".", "project_service", ".", "list_group_maintainers", "(", "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.
[ "Get", "the", "maintainers", "of", "a", "group", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L352-L366
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.add_group_maintainer
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...
python
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...
[ "def", "add_group_maintainer", "(", "self", ",", "name", ",", "user", ")", ":", "self", ".", "project_service", ".", "set_auth", "(", "self", ".", "_token_project", ")", "self", ".", "project_service", ".", "add_group_maintainer", "(", "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.HTTPError on failure.
[ "Add", "the", "given", "user", "to", "the", "named", "group", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L368-L382
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.delete_group_maintainer
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...
python
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...
[ "def", "delete_group_maintainer", "(", "self", ",", "grp_name", ",", "user", ")", ":", "self", ".", "project_service", ".", "set_auth", "(", "self", ".", "_token_project", ")", "self", ".", "project_service", ".", "delete_group_maintainer", "(", "grp_name", ",",...
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.
[ "Delete", "the", "given", "user", "to", "the", "named", "group", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L384-L398
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.get_is_group_maintainer
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....
python
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....
[ "def", "get_is_group_maintainer", "(", "self", ",", "grp_name", ",", "user", ")", ":", "self", ".", "project_service", ".", "set_auth", "(", "self", ".", "_token_project", ")", "return", "self", ".", "project_service", ".", "get_is_group_maintainer", "(", "grp_n...
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.
[ "Check", "if", "the", "given", "user", "is", "a", "member", "of", "the", "named", "group", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L400-L412
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.list_permissions
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...
python
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...
[ "def", "list_permissions", "(", "self", ",", "group_name", "=", "None", ",", "resource", "=", "None", ")", ":", "self", ".", "project_service", ".", "set_auth", "(", "self", ".", "_token_project", ")", "return", "self", ".", "project_service", ".", "list_per...
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...
[ "List", "permission", "sets", "associated", "filtering", "by", "group", "and", "/", "or", "resource", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L414-L430
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.get_permissions
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. ...
python
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. ...
[ "def", "get_permissions", "(", "self", ",", "grp_name", ",", "resource", ")", ":", "self", ".", "project_service", ".", "set_auth", "(", "self", ".", "_token_project", ")", "return", "self", ".", "project_service", ".", "get_permissions", "(", "grp_name", ",",...
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...
[ "Get", "permissions", "associated", "the", "group", "has", "with", "the", "given", "resource", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L432-L448
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.add_permissions
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 ...
python
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 ...
[ "def", "add_permissions", "(", "self", ",", "grp_name", ",", "resource", ",", "permissions", ")", ":", "self", ".", "project_service", ".", "set_auth", "(", "self", ".", "_token_project", ")", "self", ".", "project_service", ".", "add_permissions", "(", "grp_n...
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...
[ "Add", "additional", "permissions", "for", "the", "group", "associated", "with", "the", "resource", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L450-L464
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.update_permissions
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...
python
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...
[ "def", "update_permissions", "(", "self", ",", "grp_name", ",", "resource", ",", "permissions", ")", ":", "self", ".", "project_service", ".", "set_auth", "(", "self", ".", "_token_project", ")", "self", ".", "project_service", ".", "update_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 operate on permissions (list): List of permissions to add to the given...
[ "Update", "permissions", "for", "the", "group", "associated", "with", "the", "given", "resource", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L466-L480
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.delete_permissions
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...
python
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...
[ "def", "delete_permissions", "(", "self", ",", "grp_name", ",", "resource", ")", ":", "self", ".", "project_service", ".", "set_auth", "(", "self", ".", "_token_project", ")", "self", ".", "project_service", ".", "delete_permissions", "(", "grp_name", ",", "re...
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.
[ "Removes", "permissions", "from", "the", "group", "for", "the", "given", "resource", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L482-L495
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.get_user_roles
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...
python
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...
[ "def", "get_user_roles", "(", "self", ",", "user", ")", ":", "self", ".", "project_service", ".", "set_auth", "(", "self", ".", "_token_project", ")", "return", "self", ".", "project_service", ".", "get_user_roles", "(", "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.
[ "Get", "roles", "associated", "with", "the", "given", "user", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L497-L511
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.add_user_role
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...
python
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...
[ "def", "add_user_role", "(", "self", ",", "user", ",", "role", ")", ":", "self", ".", "project_service", ".", "set_auth", "(", "self", ".", "_token_project", ")", "self", ".", "project_service", ".", "add_user_role", "(", "user", ",", "role", ")" ]
Add role to given user. Args: user (string): User name. role (string): Role to assign. Raises: requests.HTTPError on failure.
[ "Add", "role", "to", "given", "user", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L513-L525
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.delete_user_role
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) ...
python
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) ...
[ "def", "delete_user_role", "(", "self", ",", "user", ",", "role", ")", ":", "self", ".", "project_service", ".", "set_auth", "(", "self", ".", "_token_project", ")", "self", ".", "project_service", ".", "delete_user_role", "(", "user", ",", "role", ")" ]
Remove role from given user. Args: user (string): User name. role (string): Role to remove. Raises: requests.HTTPError on failure.
[ "Remove", "role", "from", "given", "user", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L527-L539
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.get_user
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...
python
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...
[ "def", "get_user", "(", "self", ",", "user", ")", ":", "self", ".", "project_service", ".", "set_auth", "(", "self", ".", "_token_project", ")", "return", "self", ".", "project_service", ".", "get_user", "(", "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.
[ "Get", "user", "s", "data", "(", "first", "and", "last", "name", "email", "etc", ")", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L541-L555
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.get_user_groups
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) ...
python
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) ...
[ "def", "get_user_groups", "(", "self", ",", "user", ")", ":", "self", ".", "project_service", ".", "set_auth", "(", "self", ".", "_token_project", ")", "return", "self", ".", "project_service", ".", "get_user_groups", "(", "user", ")" ]
Get user's group memberships. Args: user (string): User name. Returns: (list): User's groups. Raises: requests.HTTPError on failure.
[ "Get", "user", "s", "group", "memberships", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L557-L571
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.add_user
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...
python
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...
[ "def", "add_user", "(", "self", ",", "user", ",", "first_name", "=", "None", ",", "last_name", "=", "None", ",", "email", "=", "None", ",", "password", "=", "None", ")", ":", "self", ".", "project_service", ".", "set_auth", "(", "self", ".", "_token_pr...
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. ...
[ "Add", "a", "new", "user", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L573-L593
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.delete_user
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)
python
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)
[ "def", "delete_user", "(", "self", ",", "user", ")", ":", "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.
[ "Delete", "the", "given", "user", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L595-L606
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote._list_resource
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...
python
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...
[ "def", "_list_resource", "(", "self", ",", "resource", ")", ":", "self", ".", "project_service", ".", "set_auth", "(", "self", ".", "_token_project", ")", "return", "super", "(", "BossRemote", ",", "self", ")", ".", "list_project", "(", "resource", "=", "r...
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...
[ "List", "all", "instances", "of", "the", "given", "resource", "type", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L608-L629
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.list_experiments
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 ...
python
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 ...
[ "def", "list_experiments", "(", "self", ",", "collection_name", ")", ":", "exp", "=", "ExperimentResource", "(", "name", "=", "''", ",", "collection_name", "=", "collection_name", ",", "coord_frame", "=", "'foo'", ")", "return", "self", ".", "_list_resource", ...
List all experiments that belong to a collection. Args: collection_name (string): Name of the parent collection. Returns: (list) Raises: requests.HTTPError on failure.
[ "List", "all", "experiments", "that", "belong", "to", "a", "collection", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L644-L659
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.list_channels
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...
python
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...
[ "def", "list_channels", "(", "self", ",", "collection_name", ",", "experiment_name", ")", ":", "dont_care", "=", "'image'", "chan", "=", "ChannelResource", "(", "name", "=", "''", ",", "collection_name", "=", "collection_name", ",", "experiment_name", "=", "expe...
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...
[ "List", "all", "channels", "belonging", "to", "the", "named", "experiment", "that", "is", "part", "of", "the", "named", "collection", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L661-L680
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.get_channel
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...
python
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...
[ "def", "get_channel", "(", "self", ",", "chan_name", ",", "coll_name", ",", "exp_name", ")", ":", "chan", "=", "ChannelResource", "(", "chan_name", ",", "coll_name", ",", "exp_name", ")", "return", "self", ".", "get_project", "(", "chan", ")" ]
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...
[ "Helper", "that", "gets", "a", "fully", "initialized", "ChannelResource", "for", "an", "*", "existing", "*", "channel", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L695-L708
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.create_project
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...
python
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...
[ "def", "create_project", "(", "self", ",", "resource", ")", ":", "self", ".", "project_service", ".", "set_auth", "(", "self", ".", "_token_project", ")", "return", "self", ".", "project_service", ".", "create", "(", "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. Raises: requests.HTTPError on failure.
[ "Create", "the", "entity", "described", "by", "the", "given", "resource", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L710-L725
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.get_project
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...
python
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...
[ "def", "get_project", "(", "self", ",", "resource", ")", ":", "self", ".", "project_service", ".", "set_auth", "(", "self", ".", "_token_project", ")", "return", "self", ".", "project_service", ".", "get", "(", "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 resource of type ...
[ "Get", "attributes", "of", "the", "data", "model", "object", "named", "by", "the", "given", "resource", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L727-L743
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.update_project
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...
python
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...
[ "def", "update_project", "(", "self", ",", "resource_name", ",", "resource", ")", ":", "self", ".", "project_service", ".", "set_auth", "(", "self", ".", "_token_project", ")", "return", "self", ".", "project_service", ".", "update", "(", "resource_name", ",",...
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. ...
[ "Updates", "an", "entity", "in", "the", "data", "model", "using", "the", "given", "resource", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L745-L763
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.delete_project
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) ...
python
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) ...
[ "def", "delete_project", "(", "self", ",", "resource", ")", ":", "self", ".", "project_service", ".", "set_auth", "(", "self", ".", "_token_project", ")", "self", ".", "project_service", ".", "delete", "(", "resource", ")" ]
Deletes the entity described by the given resource. Args: resource (intern.resource.boss.BossResource) Raises: requests.HTTPError on a failure.
[ "Deletes", "the", "entity", "described", "by", "the", "given", "resource", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L765-L776
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.list_metadata
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...
python
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...
[ "def", "list_metadata", "(", "self", ",", "resource", ")", ":", "self", ".", "metadata_service", ".", "set_auth", "(", "self", ".", "_token_metadata", ")", "return", "self", ".", "metadata_service", ".", "list", "(", "resource", ")" ]
List all keys associated with the given resource. Args: resource (intern.resource.boss.BossResource) Returns: (list) Raises: requests.HTTPError on a failure.
[ "List", "all", "keys", "associated", "with", "the", "given", "resource", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L778-L792
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.create_metadata
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...
python
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...
[ "def", "create_metadata", "(", "self", ",", "resource", ",", "keys_vals", ")", ":", "self", ".", "metadata_service", ".", "set_auth", "(", "self", ".", "_token_metadata", ")", "self", ".", "metadata_service", ".", "create", "(", "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-value pairs to assign to given resource. Rais...
[ "Associates", "new", "key", "-", "value", "pairs", "with", "the", "given", "resource", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L794-L809
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.get_metadata
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....
python
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....
[ "def", "get_metadata", "(", "self", ",", "resource", ",", "keys", ")", ":", "self", ".", "metadata_service", ".", "set_auth", "(", "self", ".", "_token_metadata", ")", "return", "self", ".", "metadata_service", ".", "get", "(", "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", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L811-L826
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.update_metadata
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...
python
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...
[ "def", "update_metadata", "(", "self", ",", "resource", ",", "keys_vals", ")", ":", "self", ".", "metadata_service", ".", "set_auth", "(", "self", ".", "_token_metadata", ")", "self", ".", "metadata_service", ".", "update", "(", "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 (dictionary): Collection of key-value pairs to update on ...
[ "Updates", "key", "-", "value", "pairs", "with", "the", "given", "resource", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L828-L844
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.delete_metadata
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: ...
python
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: ...
[ "def", "delete_metadata", "(", "self", ",", "resource", ",", "keys", ")", ":", "self", ".", "metadata_service", ".", "set_auth", "(", "self", ".", "_token_metadata", ")", "self", ".", "metadata_service", ".", "delete", "(", "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: HTTPErrorList on failure.
[ "Deletes", "the", "given", "key", "-", "value", "pairs", "associated", "with", "the", "given", "resource", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L846-L860
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.parse_bossURI
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("/")...
python
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("/")...
[ "def", "parse_bossURI", "(", "self", ",", "uri", ")", ":", "# type: (str) -> Resource", "t", "=", "uri", ".", "split", "(", "\"://\"", ")", "[", "1", "]", ".", "split", "(", "\"/\"", ")", "if", "len", "(", "t", ")", "is", "3", ":", "return", "self"...
Parse a bossDB URI and handle malform errors. Arguments: uri (str): URI of the form bossdb://<collection>/<experiment>/<channel> Returns: Resource
[ "Parse", "a", "bossDB", "URI", "and", "handle", "malform", "errors", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L862-L876
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.get_cutout
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...
python
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...
[ "def", "get_cutout", "(", "self", ",", "resource", ",", "resolution", ",", "x_range", ",", "y_range", ",", "z_range", ",", "time_range", "=", "None", ",", "id_list", "=", "[", "]", ",", "no_cache", "=", "None", ",", "access_mode", "=", "CacheMode", ".", ...
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...
[ "Get", "a", "cutout", "from", "the", "volume", "service", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L878-L923
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.get_experiment
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...
python
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...
[ "def", "get_experiment", "(", "self", ",", "coll_name", ",", "exp_name", ")", ":", "exp", "=", "ExperimentResource", "(", "exp_name", ",", "coll_name", ")", "return", "self", ".", "get_project", "(", "exp", ")" ]
Convenience method that gets experiment resource. Args: coll_name (str): Collection name exp_name (str): Experiment name Returns: (ExperimentResource)
[ "Convenience", "method", "that", "gets", "experiment", "resource", ".", "Args", ":", "coll_name", "(", "str", ")", ":", "Collection", "name", "exp_name", "(", "str", ")", ":", "Experiment", "name" ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L925-L937
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.get_neuroglancer_link
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...
python
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...
[ "def", "get_neuroglancer_link", "(", "self", ",", "resource", ",", "resolution", ",", "x_range", ",", "y_range", ",", "z_range", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_volume", ".", "get_neuroglancer_link", "(", "resource", ",", "resolut...
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...
[ "Get", "a", "neuroglancer", "link", "of", "the", "cutout", "specified", "from", "the", "host", "specified", "in", "the", "remote", "configuration", "step", "." ]
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L952-L970
rmorshea/spectate
spectate/mvc/base.py
views
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[:]
python
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[:]
[ "def", "views", "(", "model", ":", "\"Model\"", ")", "->", "list", ":", "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.
[ "Return", "a", "model", "s", "views", "keyed", "on", "what", "events", "they", "respond", "to", "." ]
train
https://github.com/rmorshea/spectate/blob/79bd84dd8d00889015ce1d1e190db865a02cdb93/spectate/mvc/base.py#L14-L21
rmorshea/spectate
spectate/mvc/base.py
view
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...
python
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...
[ "def", "view", "(", "model", ":", "\"Model\"", ",", "*", "functions", ":", "Callable", ")", "->", "Optional", "[", "Callable", "]", ":", "if", "not", "isinstance", "(", "model", ",", "Model", ")", ":", "raise", "TypeError", "(", "\"Expected a Model, not %r...
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...
[ "A", "decorator", "for", "registering", "a", "callback", "to", "a", "model" ]
train
https://github.com/rmorshea/spectate/blob/79bd84dd8d00889015ce1d1e190db865a02cdb93/spectate/mvc/base.py#L24-L55
rmorshea/spectate
spectate/mvc/base.py
Control.before
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 ...
python
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 ...
[ "def", "before", "(", "self", ",", "callback", ":", "Union", "[", "Callable", ",", "str", "]", ")", "->", "\"Control\"", ":", "if", "isinstance", "(", "callback", ",", "Control", ")", ":", "callback", "=", "callback", ".", "_before", "self", ".", "_bef...
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 ...
[ "Register", "a", "control", "method", "that", "reacts", "before", "the", "trigger", "method", "is", "called", "." ]
train
https://github.com/rmorshea/spectate/blob/79bd84dd8d00889015ce1d1e190db865a02cdb93/spectate/mvc/base.py#L137-L149
rmorshea/spectate
spectate/mvc/base.py
Control.after
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...
python
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...
[ "def", "after", "(", "self", ",", "callback", ":", "Union", "[", "Callable", ",", "str", "]", ")", "->", "\"Control\"", ":", "if", "isinstance", "(", "callback", ",", "Control", ")", ":", "callback", "=", "callback", ".", "_after", "self", ".", "_after...
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...
[ "Register", "a", "control", "method", "that", "reacts", "after", "the", "trigger", "method", "is", "called", "." ]
train
https://github.com/rmorshea/spectate/blob/79bd84dd8d00889015ce1d1e190db865a02cdb93/spectate/mvc/base.py#L151-L163
witchard/grole
grole.py
serve_static
def serve_static(app, base_url, base_path, index=False): """ Serve a directory statically Parameters: * app: Grole application object * base_url: Base URL to serve from, e.g. /static * base_path: Base path to look for files in * index: Provide simple directory indexes if Tr...
python
def serve_static(app, base_url, base_path, index=False): """ Serve a directory statically Parameters: * app: Grole application object * base_url: Base URL to serve from, e.g. /static * base_path: Base path to look for files in * index: Provide simple directory indexes if Tr...
[ "def", "serve_static", "(", "app", ",", "base_url", ",", "base_path", ",", "index", "=", "False", ")", ":", "@", "app", ".", "route", "(", "base_url", "+", "'/(.*)'", ")", "def", "serve", "(", "env", ",", "req", ")", ":", "\"\"\"\n Static files\n ...
Serve a directory statically Parameters: * app: Grole application object * base_url: Base URL to serve from, e.g. /static * base_path: Base path to look for files in * index: Provide simple directory indexes if True
[ "Serve", "a", "directory", "statically" ]
train
https://github.com/witchard/grole/blob/54c0bd13e4d4c74a2997ec4254527d937d6e0565/grole.py#L242-L282
witchard/grole
grole.py
serve_doc
def serve_doc(app, url): """ Serve API documentation extracted from request handler docstrings Parameters: * app: Grole application object * url: URL to serve at """ @app.route(url, doc=False) def index(env, req): ret = '' for d in env['doc']: ret += ...
python
def serve_doc(app, url): """ Serve API documentation extracted from request handler docstrings Parameters: * app: Grole application object * url: URL to serve at """ @app.route(url, doc=False) def index(env, req): ret = '' for d in env['doc']: ret += ...
[ "def", "serve_doc", "(", "app", ",", "url", ")", ":", "@", "app", ".", "route", "(", "url", ",", "doc", "=", "False", ")", "def", "index", "(", "env", ",", "req", ")", ":", "ret", "=", "''", "for", "d", "in", "env", "[", "'doc'", "]", ":", ...
Serve API documentation extracted from request handler docstrings Parameters: * app: Grole application object * url: URL to serve at
[ "Serve", "API", "documentation", "extracted", "from", "request", "handler", "docstrings" ]
train
https://github.com/witchard/grole/blob/54c0bd13e4d4c74a2997ec4254527d937d6e0565/grole.py#L284-L297
witchard/grole
grole.py
parse_args
def parse_args(args=sys.argv[1:]): """ Parse command line arguments for Grole server running as static file server """ parser = argparse.ArgumentParser() parser.add_argument('-a', '--address', help='address to listen on, default localhost', default='localhost') pa...
python
def parse_args(args=sys.argv[1:]): """ Parse command line arguments for Grole server running as static file server """ parser = argparse.ArgumentParser() parser.add_argument('-a', '--address', help='address to listen on, default localhost', default='localhost') pa...
[ "def", "parse_args", "(", "args", "=", "sys", ".", "argv", "[", "1", ":", "]", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "parser", ".", "add_argument", "(", "'-a'", ",", "'--address'", ",", "help", "=", "'address to listen on,...
Parse command line arguments for Grole server running as static file server
[ "Parse", "command", "line", "arguments", "for", "Grole", "server", "running", "as", "static", "file", "server" ]
train
https://github.com/witchard/grole/blob/54c0bd13e4d4c74a2997ec4254527d937d6e0565/grole.py#L413-L431
witchard/grole
grole.py
main
def main(args=sys.argv[1:]): """ Run Grole static file server """ args = parse_args(args) if args.verbose: logging.basicConfig(level=logging.DEBUG) elif args.quiet: logging.basicConfig(level=logging.ERROR) else: logging.basicConfig(level=logging.INFO) app = Grole(...
python
def main(args=sys.argv[1:]): """ Run Grole static file server """ args = parse_args(args) if args.verbose: logging.basicConfig(level=logging.DEBUG) elif args.quiet: logging.basicConfig(level=logging.ERROR) else: logging.basicConfig(level=logging.INFO) app = Grole(...
[ "def", "main", "(", "args", "=", "sys", ".", "argv", "[", "1", ":", "]", ")", ":", "args", "=", "parse_args", "(", "args", ")", "if", "args", ".", "verbose", ":", "logging", ".", "basicConfig", "(", "level", "=", "logging", ".", "DEBUG", ")", "el...
Run Grole static file server
[ "Run", "Grole", "static", "file", "server" ]
train
https://github.com/witchard/grole/blob/54c0bd13e4d4c74a2997ec4254527d937d6e0565/grole.py#L433-L446
witchard/grole
grole.py
Request._read
async def _read(self, reader): """ Parses HTTP request into member variables """ start_line = await self._readline(reader) self.method, self.location, self.version = start_line.decode().split() path_query = urllib.parse.unquote(self.location).split('?', 1) self.pa...
python
async def _read(self, reader): """ Parses HTTP request into member variables """ start_line = await self._readline(reader) self.method, self.location, self.version = start_line.decode().split() path_query = urllib.parse.unquote(self.location).split('?', 1) self.pa...
[ "async", "def", "_read", "(", "self", ",", "reader", ")", ":", "start_line", "=", "await", "self", ".", "_readline", "(", "reader", ")", "self", ".", "method", ",", "self", ".", "location", ",", "self", ".", "version", "=", "start_line", ".", "decode",...
Parses HTTP request into member variables
[ "Parses", "HTTP", "request", "into", "member", "variables" ]
train
https://github.com/witchard/grole/blob/54c0bd13e4d4c74a2997ec4254527d937d6e0565/grole.py#L40-L66
witchard/grole
grole.py
Request._readline
async def _readline(self, reader): """ Readline helper """ ret = await reader.readline() if len(ret) == 0 and reader.at_eof(): raise EOFError() return ret
python
async def _readline(self, reader): """ Readline helper """ ret = await reader.readline() if len(ret) == 0 and reader.at_eof(): raise EOFError() return ret
[ "async", "def", "_readline", "(", "self", ",", "reader", ")", ":", "ret", "=", "await", "reader", ".", "readline", "(", ")", "if", "len", "(", "ret", ")", "==", "0", "and", "reader", ".", "at_eof", "(", ")", ":", "raise", "EOFError", "(", ")", "r...
Readline helper
[ "Readline", "helper" ]
train
https://github.com/witchard/grole/blob/54c0bd13e4d4c74a2997ec4254527d937d6e0565/grole.py#L68-L75
witchard/grole
grole.py
Request._buffer_body
async def _buffer_body(self, reader): """ Buffers the body of the request """ remaining = int(self.headers.get('Content-Length', 0)) if remaining > 0: try: self.data = await reader.readexactly(remaining) except asyncio.IncompleteReadError: ...
python
async def _buffer_body(self, reader): """ Buffers the body of the request """ remaining = int(self.headers.get('Content-Length', 0)) if remaining > 0: try: self.data = await reader.readexactly(remaining) except asyncio.IncompleteReadError: ...
[ "async", "def", "_buffer_body", "(", "self", ",", "reader", ")", ":", "remaining", "=", "int", "(", "self", ".", "headers", ".", "get", "(", "'Content-Length'", ",", "0", ")", ")", "if", "remaining", ">", "0", ":", "try", ":", "self", ".", "data", ...
Buffers the body of the request
[ "Buffers", "the", "body", "of", "the", "request" ]
train
https://github.com/witchard/grole/blob/54c0bd13e4d4c74a2997ec4254527d937d6e0565/grole.py#L77-L86
witchard/grole
grole.py
Grole.route
def route(self, path_regex, methods=['GET'], doc=True): """ Decorator to register a handler Parameters: * path_regex: Request path regex to match against for running the handler * methods: HTTP methods to use this handler for * doc: Add to internal doc struct...
python
def route(self, path_regex, methods=['GET'], doc=True): """ Decorator to register a handler Parameters: * path_regex: Request path regex to match against for running the handler * methods: HTTP methods to use this handler for * doc: Add to internal doc struct...
[ "def", "route", "(", "self", ",", "path_regex", ",", "methods", "=", "[", "'GET'", "]", ",", "doc", "=", "True", ")", ":", "def", "register_func", "(", "func", ")", ":", "\"\"\"\n Decorator implementation\n \"\"\"", "if", "doc", ":", "sel...
Decorator to register a handler Parameters: * path_regex: Request path regex to match against for running the handler * methods: HTTP methods to use this handler for * doc: Add to internal doc structure
[ "Decorator", "to", "register", "a", "handler" ]
train
https://github.com/witchard/grole/blob/54c0bd13e4d4c74a2997ec4254527d937d6e0565/grole.py#L316-L334
witchard/grole
grole.py
Grole._handle
async def _handle(self, reader, writer): """ Handle a single TCP connection Parses requests, finds appropriate handlers and returns responses """ peer = writer.get_extra_info('peername') self._logger.debug('New connection from {}'.format(peer)) try: #...
python
async def _handle(self, reader, writer): """ Handle a single TCP connection Parses requests, finds appropriate handlers and returns responses """ peer = writer.get_extra_info('peername') self._logger.debug('New connection from {}'.format(peer)) try: #...
[ "async", "def", "_handle", "(", "self", ",", "reader", ",", "writer", ")", ":", "peer", "=", "writer", ".", "get_extra_info", "(", "'peername'", ")", "self", ".", "_logger", ".", "debug", "(", "'New connection from {}'", ".", "format", "(", "peer", ")", ...
Handle a single TCP connection Parses requests, finds appropriate handlers and returns responses
[ "Handle", "a", "single", "TCP", "connection" ]
train
https://github.com/witchard/grole/blob/54c0bd13e4d4c74a2997ec4254527d937d6e0565/grole.py#L336-L381
witchard/grole
grole.py
Grole.run
def run(self, host='localhost', port=1234): """ Launch the server. Will run forever accepting connections until interrupted. Parameters: * host: The host to listen on * port: The port to listen on """ # Setup loop loop = asyncio.get_event_loop() ...
python
def run(self, host='localhost', port=1234): """ Launch the server. Will run forever accepting connections until interrupted. Parameters: * host: The host to listen on * port: The port to listen on """ # Setup loop loop = asyncio.get_event_loop() ...
[ "def", "run", "(", "self", ",", "host", "=", "'localhost'", ",", "port", "=", "1234", ")", ":", "# Setup loop", "loop", "=", "asyncio", ".", "get_event_loop", "(", ")", "coro", "=", "asyncio", ".", "start_server", "(", "self", ".", "_handle", ",", "hos...
Launch the server. Will run forever accepting connections until interrupted. Parameters: * host: The host to listen on * port: The port to listen on
[ "Launch", "the", "server", ".", "Will", "run", "forever", "accepting", "connections", "until", "interrupted", "." ]
train
https://github.com/witchard/grole/blob/54c0bd13e4d4c74a2997ec4254527d937d6e0565/grole.py#L383-L411
rmorshea/spectate
spectate/mvc/events.py
hold
def hold(model: Model, reducer: Optional[Callable] = None) -> Iterator[list]: """Temporarilly withold change events in a modifiable list. All changes that are captured within a "hold" context are forwarded to a list which is yielded to the user before being sent to views of the given ``model``. If desi...
python
def hold(model: Model, reducer: Optional[Callable] = None) -> Iterator[list]: """Temporarilly withold change events in a modifiable list. All changes that are captured within a "hold" context are forwarded to a list which is yielded to the user before being sent to views of the given ``model``. If desi...
[ "def", "hold", "(", "model", ":", "Model", ",", "reducer", ":", "Optional", "[", "Callable", "]", "=", "None", ")", "->", "Iterator", "[", "list", "]", ":", "if", "not", "isinstance", "(", "model", ",", "Model", ")", ":", "raise", "TypeError", "(", ...
Temporarilly withold change events in a modifiable list. All changes that are captured within a "hold" context are forwarded to a list which is yielded to the user before being sent to views of the given ``model``. If desired, the user may modify the list of events before the context is left in order t...
[ "Temporarilly", "withold", "change", "events", "in", "a", "modifiable", "list", "." ]
train
https://github.com/rmorshea/spectate/blob/79bd84dd8d00889015ce1d1e190db865a02cdb93/spectate/mvc/events.py#L12-L76
rmorshea/spectate
spectate/mvc/events.py
rollback
def rollback( model: Model, undo: Optional[Callable] = None, *args, **kwargs ) -> Iterator[list]: """Withold events if an error occurs. Generall operate Parameters: model: The model object whose change events may be witheld. undo: An optional function for revers...
python
def rollback( model: Model, undo: Optional[Callable] = None, *args, **kwargs ) -> Iterator[list]: """Withold events if an error occurs. Generall operate Parameters: model: The model object whose change events may be witheld. undo: An optional function for revers...
[ "def", "rollback", "(", "model", ":", "Model", ",", "undo", ":", "Optional", "[", "Callable", "]", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", "->", "Iterator", "[", "list", "]", ":", "with", "hold", "(", "model", ",", "*", "args...
Withold events if an error occurs. Generall operate Parameters: model: The model object whose change events may be witheld. undo: An optional function for reversing any changes that may have taken place. Its signature is ``(model, events, error)`` where ``mo...
[ "Withold", "events", "if", "an", "error", "occurs", "." ]
train
https://github.com/rmorshea/spectate/blob/79bd84dd8d00889015ce1d1e190db865a02cdb93/spectate/mvc/events.py#L80-L156
rmorshea/spectate
spectate/mvc/events.py
mute
def mute(model: Model): """Block a model's views from being notified. All changes within a "mute" context will be blocked. No content is yielded to the user as in :func:`hold`, and the views of the model are never notified that changes took place. Parameters: mode: The model whose change e...
python
def mute(model: Model): """Block a model's views from being notified. All changes within a "mute" context will be blocked. No content is yielded to the user as in :func:`hold`, and the views of the model are never notified that changes took place. Parameters: mode: The model whose change e...
[ "def", "mute", "(", "model", ":", "Model", ")", ":", "if", "not", "isinstance", "(", "model", ",", "Model", ")", ":", "raise", "TypeError", "(", "\"Expected a Model, not %r.\"", "%", "model", ")", "restore", "=", "model", ".", "__dict__", ".", "get", "("...
Block a model's views from being notified. All changes within a "mute" context will be blocked. No content is yielded to the user as in :func:`hold`, and the views of the model are never notified that changes took place. Parameters: mode: The model whose change events will be blocked. Exa...
[ "Block", "a", "model", "s", "views", "from", "being", "notified", "." ]
train
https://github.com/rmorshea/spectate/blob/79bd84dd8d00889015ce1d1e190db865a02cdb93/spectate/mvc/events.py#L160-L197
rmorshea/spectate
spectate/core.py
expose
def expose(*methods): """A decorator for exposing the methods of a class. Parameters ---------- *methods : str A str representation of the methods that should be exposed to callbacks. Returns ------- decorator : function A function accepting one argument - the class whose m...
python
def expose(*methods): """A decorator for exposing the methods of a class. Parameters ---------- *methods : str A str representation of the methods that should be exposed to callbacks. Returns ------- decorator : function A function accepting one argument - the class whose m...
[ "def", "expose", "(", "*", "methods", ")", ":", "def", "setup", "(", "base", ")", ":", "return", "expose_as", "(", "base", ".", "__name__", ",", "base", ",", "*", "methods", ")", "return", "setup" ]
A decorator for exposing the methods of a class. Parameters ---------- *methods : str A str representation of the methods that should be exposed to callbacks. Returns ------- decorator : function A function accepting one argument - the class whose methods will be expose...
[ "A", "decorator", "for", "exposing", "the", "methods", "of", "a", "class", "." ]
train
https://github.com/rmorshea/spectate/blob/79bd84dd8d00889015ce1d1e190db865a02cdb93/spectate/core.py#L250-L273
rmorshea/spectate
spectate/core.py
expose_as
def expose_as(name, base, *methods): """Return a new type with certain methods that are exposed to callback registration. Parameters ---------- name : str The name of the new type. base : type A type such as list or dict. *methods : str A str representation of the method...
python
def expose_as(name, base, *methods): """Return a new type with certain methods that are exposed to callback registration. Parameters ---------- name : str The name of the new type. base : type A type such as list or dict. *methods : str A str representation of the method...
[ "def", "expose_as", "(", "name", ",", "base", ",", "*", "methods", ")", ":", "classdict", "=", "{", "}", "for", "method", "in", "methods", ":", "if", "not", "hasattr", "(", "base", ",", "method", ")", ":", "raise", "AttributeError", "(", "\"Cannot expo...
Return a new type with certain methods that are exposed to callback registration. Parameters ---------- name : str The name of the new type. base : type A type such as list or dict. *methods : str A str representation of the methods that should be exposed to callbacks. ...
[ "Return", "a", "new", "type", "with", "certain", "methods", "that", "are", "exposed", "to", "callback", "registration", "." ]
train
https://github.com/rmorshea/spectate/blob/79bd84dd8d00889015ce1d1e190db865a02cdb93/spectate/core.py#L276-L302
rmorshea/spectate
spectate/core.py
watchable
def watchable(value): """Returns True if the given value is a :class:`Watchable` subclass or instance.""" check = issubclass if inspect.isclass(value) else isinstance return check(value, Watchable)
python
def watchable(value): """Returns True if the given value is a :class:`Watchable` subclass or instance.""" check = issubclass if inspect.isclass(value) else isinstance return check(value, Watchable)
[ "def", "watchable", "(", "value", ")", ":", "check", "=", "issubclass", "if", "inspect", ".", "isclass", "(", "value", ")", "else", "isinstance", "return", "check", "(", "value", ",", "Watchable", ")" ]
Returns True if the given value is a :class:`Watchable` subclass or instance.
[ "Returns", "True", "if", "the", "given", "value", "is", "a", ":", "class", ":", "Watchable", "subclass", "or", "instance", "." ]
train
https://github.com/rmorshea/spectate/blob/79bd84dd8d00889015ce1d1e190db865a02cdb93/spectate/core.py#L305-L308
rmorshea/spectate
spectate/core.py
watch
def watch(value, spectator_type=Spectator): """Register a :class:`Specatator` to a :class:`Watchable` and return it. In order to register callbacks to an eventful object, you need to create a Spectator that will watch it for you. A :class:`Specatator` is a relatively simple object that has methods for ...
python
def watch(value, spectator_type=Spectator): """Register a :class:`Specatator` to a :class:`Watchable` and return it. In order to register callbacks to an eventful object, you need to create a Spectator that will watch it for you. A :class:`Specatator` is a relatively simple object that has methods for ...
[ "def", "watch", "(", "value", ",", "spectator_type", "=", "Spectator", ")", ":", "if", "isinstance", "(", "value", ",", "Watchable", ")", ":", "wtype", "=", "type", "(", "value", ")", "else", ":", "raise", "TypeError", "(", "\"Expected a Watchable, not %r.\"...
Register a :class:`Specatator` to a :class:`Watchable` and return it. In order to register callbacks to an eventful object, you need to create a Spectator that will watch it for you. A :class:`Specatator` is a relatively simple object that has methods for adding, deleting, and triggering callbacks. To ...
[ "Register", "a", ":", "class", ":", "Specatator", "to", "a", ":", "class", ":", "Watchable", "and", "return", "it", "." ]
train
https://github.com/rmorshea/spectate/blob/79bd84dd8d00889015ce1d1e190db865a02cdb93/spectate/core.py#L311-L341
rmorshea/spectate
spectate/core.py
watched
def watched(cls, *args, **kwargs): """Create and return a :class:`Watchable` with its :class:`Specatator`. See :func:`watch` for more info on :class:`Specatator` registration. Parameters ---------- cls: type: A subclass of :class:`Watchable` *args: Positional arguments used to ...
python
def watched(cls, *args, **kwargs): """Create and return a :class:`Watchable` with its :class:`Specatator`. See :func:`watch` for more info on :class:`Specatator` registration. Parameters ---------- cls: type: A subclass of :class:`Watchable` *args: Positional arguments used to ...
[ "def", "watched", "(", "cls", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "value", "=", "cls", "(", "*", "args", ",", "*", "*", "kwargs", ")", "return", "value", ",", "watch", "(", "value", ")" ]
Create and return a :class:`Watchable` with its :class:`Specatator`. See :func:`watch` for more info on :class:`Specatator` registration. Parameters ---------- cls: type: A subclass of :class:`Watchable` *args: Positional arguments used to create the instance **kwargs: ...
[ "Create", "and", "return", "a", ":", "class", ":", "Watchable", "with", "its", ":", "class", ":", "Specatator", "." ]
train
https://github.com/rmorshea/spectate/blob/79bd84dd8d00889015ce1d1e190db865a02cdb93/spectate/core.py#L344-L359
rmorshea/spectate
spectate/core.py
unwatch
def unwatch(value): """Return the :class:`Specatator` of a :class:`Watchable` instance.""" if not isinstance(value, Watchable): raise TypeError("Expected a Watchable, not %r." % value) spectator = watcher(value) try: del value._instance_spectator except Exception: pass re...
python
def unwatch(value): """Return the :class:`Specatator` of a :class:`Watchable` instance.""" if not isinstance(value, Watchable): raise TypeError("Expected a Watchable, not %r." % value) spectator = watcher(value) try: del value._instance_spectator except Exception: pass re...
[ "def", "unwatch", "(", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "Watchable", ")", ":", "raise", "TypeError", "(", "\"Expected a Watchable, not %r.\"", "%", "value", ")", "spectator", "=", "watcher", "(", "value", ")", "try", ":", "d...
Return the :class:`Specatator` of a :class:`Watchable` instance.
[ "Return", "the", ":", "class", ":", "Specatator", "of", "a", ":", "class", ":", "Watchable", "instance", "." ]
train
https://github.com/rmorshea/spectate/blob/79bd84dd8d00889015ce1d1e190db865a02cdb93/spectate/core.py#L362-L371
rmorshea/spectate
spectate/core.py
Spectator.callback
def callback(self, name, before=None, after=None): """Add a callback pair to this spectator. You can specify, with keywords, whether each callback should be triggered before, and/or or after a given method is called - hereafter refered to as "beforebacks" and "afterbacks" respectively. ...
python
def callback(self, name, before=None, after=None): """Add a callback pair to this spectator. You can specify, with keywords, whether each callback should be triggered before, and/or or after a given method is called - hereafter refered to as "beforebacks" and "afterbacks" respectively. ...
[ "def", "callback", "(", "self", ",", "name", ",", "before", "=", "None", ",", "after", "=", "None", ")", ":", "if", "isinstance", "(", "name", ",", "(", "list", ",", "tuple", ")", ")", ":", "for", "name", "in", "name", ":", "self", ".", "callback...
Add a callback pair to this spectator. You can specify, with keywords, whether each callback should be triggered before, and/or or after a given method is called - hereafter refered to as "beforebacks" and "afterbacks" respectively. Parameters ---------- name: str ...
[ "Add", "a", "callback", "pair", "to", "this", "spectator", "." ]
train
https://github.com/rmorshea/spectate/blob/79bd84dd8d00889015ce1d1e190db865a02cdb93/spectate/core.py#L74-L117
rmorshea/spectate
spectate/core.py
Spectator.remove_callback
def remove_callback(self, name, before=None, after=None): """Remove a beforeback, and afterback pair from this Spectator If ``before`` and ``after`` are None then all callbacks for the given method will be removed. Otherwise, only the exact callback pair will be removed. Parame...
python
def remove_callback(self, name, before=None, after=None): """Remove a beforeback, and afterback pair from this Spectator If ``before`` and ``after`` are None then all callbacks for the given method will be removed. Otherwise, only the exact callback pair will be removed. Parame...
[ "def", "remove_callback", "(", "self", ",", "name", ",", "before", "=", "None", ",", "after", "=", "None", ")", ":", "if", "isinstance", "(", "name", ",", "(", "list", ",", "tuple", ")", ")", ":", "for", "name", "in", "name", ":", "self", ".", "r...
Remove a beforeback, and afterback pair from this Spectator If ``before`` and ``after`` are None then all callbacks for the given method will be removed. Otherwise, only the exact callback pair will be removed. Parameters ---------- name: str The name of the...
[ "Remove", "a", "beforeback", "and", "afterback", "pair", "from", "this", "Spectator" ]
train
https://github.com/rmorshea/spectate/blob/79bd84dd8d00889015ce1d1e190db865a02cdb93/spectate/core.py#L119-L149
rmorshea/spectate
spectate/core.py
Spectator.call
def call(self, obj, name, method, args, kwargs): """Trigger a method along with its beforebacks and afterbacks. Parameters ---------- name: str The name of the method that will be called args: tuple The arguments that will be passed to the base method ...
python
def call(self, obj, name, method, args, kwargs): """Trigger a method along with its beforebacks and afterbacks. Parameters ---------- name: str The name of the method that will be called args: tuple The arguments that will be passed to the base method ...
[ "def", "call", "(", "self", ",", "obj", ",", "name", ",", "method", ",", "args", ",", "kwargs", ")", ":", "if", "name", "in", "self", ".", "_callback_registry", ":", "beforebacks", ",", "afterbacks", "=", "zip", "(", "*", "self", ".", "_callback_regist...
Trigger a method along with its beforebacks and afterbacks. Parameters ---------- name: str The name of the method that will be called args: tuple The arguments that will be passed to the base method kwargs: dict The keyword args that will be ...
[ "Trigger", "a", "method", "along", "with", "its", "beforebacks", "and", "afterbacks", "." ]
train
https://github.com/rmorshea/spectate/blob/79bd84dd8d00889015ce1d1e190db865a02cdb93/spectate/core.py#L151-L186