IssuesApi¶
- class IssuesApi[source]¶
Bases:
supervisely.api.module_api.ModuleApiBaseClass for working with issues in Supervisely.
- Parameters
- api : Api
API connection to the server.
- Usage example
import os from dotenv import load_dotenv
import supervisely as sly
# Load secrets and create API object from .env file (recommended) # Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication if sly.is_development():
load_dotenv(os.path.expanduser(“~/supervisely.env”))
api = sly.Api.from_env()
# Get list of issues in specified team. issues = api.issues.get_list(team_id=1)
# Get information about issue by its ID. issue_info = api.issues.get_info_by_id(id=1)
# Add new issue. new_issue = api.issues.add(team_id=1, issue_name=”New issue”, comment=”Some comment”)
Methods
Add a new issue and return information about it.
Add a comment to the issue with the specified ID.
Add a subissue to the specified issue.
_convert_info_to_json
Get information about the issue by its ID.
Get list of issues in the specified team.
Get list of all or limited quantity entities from the Supervisely server.
This generator function retrieves a list of all or a limited quantity of entities from the Supervisely server, yielding batches of entities as they are retrieved
Get the list of items for a given page number.
Yields list of images in dataset asynchronously page by page.
List of fields that are returned by the API to represent IssueInfo.
Name of the tuple that represents IssueInfo.
Remove the issue by its ID.
Update information about the issue.
Update the comment with the specified ID.
Attributes
MAX_WAIT_ATTEMPTSMaximum number of attempts that will be made to wait for a certain condition to be met.
WAIT_ATTEMPT_TIMEOUT_SECNumber of seconds for intervals between attempts.
- InfoType¶
alias of
supervisely.api.module_api.IssueInfo
-
add(team_id, issue_name, comment=
None, assignees=None, is_local=False)[source]¶ Add a new issue and return information about it.
- Parameters
- team_id : int
Team ID.
- issue_name : str
Name of the issue.
- comment : str, optional
Comment for the issue.
- assignees : List[int], optional
List of user IDs to assign the issue.
- is_local : bool
The local issue will be available only for the members of the team, where it was created. If set to False, the issue will be available for all users from all teams.
- Returns
Information about the added issue.
- Return type
IssueInfo
- Usage example
import os from dotenv import load_dotenv import supervisely as sly # Load secrets and create API object from .env file (recommended) # Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication if sly.is_development(): load_dotenv(os.path.expanduser("~/supervisely.env")) api = sly.Api.from_env() # Add new issue. new_issue = api.issues.add(team_id=1, issue_name="New issue", comment="Some comment")
- add_comment(issue_id, comment)[source]¶
Add a comment to the issue with the specified ID.
- Parameters
- Returns
Information about the added comment.
- Return type
CommentInfo
- Usage example
import os from dotenv import load_dotenv import supervisely as sly # Load secrets and create API object from .env file (recommended) # Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication if sly.is_development(): load_dotenv(os.path.expanduser("~/supervisely.env")) api = sly.Api.from_env() # Add a comment to the issue with the specified ID. comment_info = api.issues.add_comment(issue_id=1, comment="Some comment")
- add_subissue(issue_id, image_ids, label_ids, top, left, annotation_info, project_meta)[source]¶
Add a subissue to the specified issue. Image and label IDs should be the same type, e.g. both int or list of ints. If they are lists, they should have the same length. Annotation info should be an instance of AnnotationInfo, not sly.Annotation, since the second one does not contain required information.
- Parameters
- issue_id : int
Issue ID.
- image_ids : Union[int, List[int]]
Image ID or list of image IDs to be binded with the issue.
- label_ids : Union[int, List[int]]
Label ID or list of label IDs to be binded with the issue.
- top : Union[int, float]
Top position of the marker of subissue in the Labeling interface.
- left : Union[int, float]
Left position of the marker of subissue in the Labeling interface.
- annotation_info : AnnotationInfo
Information about the annotation.
- project_meta : ProjectMeta
Project meta information.
- Usage example
import os from dotenv import load_dotenv import supervisely as sly # Load secrets and create API object from .env file (recommended) # Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication if sly.is_development(): load_dotenv(os.path.expanduser("~/supervisely.env")) api = sly.Api.from_env() project_id = 123 image_id = 456 label_id = 789 # Get project meta and annotation info. project_meta = sly.ProjectMeta.from_json(api.project.get_meta(project_id)) annotation_info = api.annotation.download(image_id) # Add a subissue to the specified issue. api.issues.add_subissue( issue_id=1, image_ids=image_id, label_ids=label_id, top=100, left=100, annotation_info=annotation_info, project_meta=project_meta )- Return type
- get_info_by_id(id)[source]¶
Get information about the issue by its ID.
- Parameters
- id : int
Issue ID.
- Returns
Information about the issue.
- Return type
IssueInfo
- Usage example
import os from dotenv import load_dotenv import supervisely as sly # Load secrets and create API object from .env file (recommended) # Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication if sly.is_development(): load_dotenv(os.path.expanduser("~/supervisely.env")) api = sly.Api.from_env() # Get information about the issue by its ID. issue_info = api.issues.get_info_by_id(1)
-
get_list(team_id, filters=
None)[source]¶ Get list of issues in the specified team.
- Parameters
- Returns
List of issues.
- Return type
List[IssueInfo]
- Usage example
import os from dotenv import load_dotenv import supervisely as sly # Load secrets and create API object from .env file (recommended) # Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication if sly.is_development(): load_dotenv(os.path.expanduser("~/supervisely.env")) api = sly.Api.from_env() # Get list of issues in specified team. issues = api.issues.get_list(team_id=1)
-
get_list_all_pages(method, data, progress_cb=
None, convert_json_info_cb=None, limit=None, return_first_response=False)¶ Get list of all or limited quantity entities from the Supervisely server.
- Parameters
- method : str
Request method name
- data : dict
Dictionary with request body info
- progress_cb : Progress, optional
Function for tracking download progress.
- convert_json_info_cb : Callable, optional
Function for convert json info
- limit : int, optional
Number of entity to retrieve
- return_first_response : bool, optional
Specify if return first response
-
get_list_all_pages_generator(method, data, progress_cb=
None, convert_json_info_cb=None, limit=None, return_first_response=False)¶ This generator function retrieves a list of all or a limited quantity of entities from the Supervisely server, yielding batches of entities as they are retrieved
- Parameters
- method : str
Request method name
- data : dict
Dictionary with request body info
- progress_cb : Progress, optional
Function for tracking download progress.
- convert_json_info_cb : Callable, optional
Function for convert json info
- limit : int, optional
Number of entity to retrieve
- return_first_response : bool, optional
Specify if return first response
- async get_list_idx_page_async(method, data)¶
Get the list of items for a given page number. Page number is specified in the data dictionary.
-
async get_list_page_generator_async(method, data, pages_count=
None, semaphore=None)¶ Yields list of images in dataset asynchronously page by page.
- Parameters
- method : str
Method to call for listing items.
- data : dict
Data to pass to the API method.
- pages_count : int, optional
Preferred number of pages to retrieve if used with a
per_pagelimit. Will be automatically adjusted if thepagesCountdiffers from the requested number.- semaphore :
asyncio.Semaphore, optional Semaphore for limiting the number of simultaneous requests.
- kwargs
Additional arguments.
- Returns
List of images in dataset.
- Return type
AsyncGenerator[List[ImageInfo]]
- Usage example
import supervisely as sly import asyncio os.environ['SERVER_ADDRESS'] = 'https://app.supervisely.com' os.environ['API_TOKEN'] = 'Your Supervisely API Token' api = sly.Api.from_env() method = 'images.list' data = { 'datasetId': 123456 } loop = sly.utils.get_or_create_event_loop() images = loop.run_until_complete(api.image.get_list_generator_async(method, data))
- remove(issue_id)[source]¶
Remove the issue by its ID. NOTE: This operation is irreversible.
- Parameters
- issue_id : int
Issue ID.
- Usage example
import os from dotenv import load_dotenv import supervisely as sly # Load secrets and create API object from .env file (recommended) # Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication if sly.is_development(): load_dotenv(os.path.expanduser("~/supervisely.env")) api = sly.Api.from_env() # Remove the issue by its ID. api.issues.remove(issue_id=1)- Return type
-
update(issue_id, issue_name=
None, status=None, is_pinned=None)[source]¶ Update information about the issue.
- Parameters
- Raises
ValueError – If the status is incorrect.
- Returns
Information about the issue.
- Return type
IssueInfo
- Usage example
import os from dotenv import load_dotenv import supervisely as sly # Load secrets and create API object from .env file (recommended) # Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication if sly.is_development(): load_dotenv(os.path.expanduser("~/supervisely.env")) api = sly.Api.from_env() # Update information about the issue. updated_issue = api.issues.update(issue_id=1, issue_name="Updated issue name")
- update_comment(comment_id, comment)[source]¶
Update the comment with the specified ID.
- Parameters
- Returns
Information about the updated comment.
- Return type
CommentInfo
- Usage example
import os from dotenv import load_dotenv import supervisely as sly # Load secrets and create API object from .env file (recommended) # Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication if sly.is_development(): load_dotenv(os.path.expanduser("~/supervisely.env")) api = sly.Api.from_env() # Update the comment with the specified ID. api.issues.update_comment(comment_id=1, comment="Updated comment")