Skip to content

Commit 83bfc53

Browse files
committed
types
1 parent a61e64d commit 83bfc53

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

labelbox/schema/batch.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Generator
1+
from typing import Generator, TYPE_CHECKING
22
from labelbox.orm.db_object import DbObject, experimental
33
from labelbox.orm import query
44
from labelbox.orm.model import Entity, Field, Relationship
@@ -9,6 +9,9 @@
99
import logging
1010
import time
1111

12+
if TYPE_CHECKING:
13+
from labelbox import Project
14+
1215
logger = logging.getLogger(__name__)
1316

1417

@@ -37,24 +40,25 @@ def __init__(self, client, project_id, *args, **kwargs):
3740
super().__init__(client, *args, **kwargs)
3841
self.project_id = project_id
3942

40-
def project(self) -> Entity.Project:
43+
def project(self) -> Project:
4144
""" Returns Project which this Batch belongs to
4245
4346
Raises:
4447
LabelboxError: if the project is not found
4548
"""
49+
Project = Entity.Project
4650
query_str = """query getProjectPyApi($projectId: ID!) {
4751
project(
4852
where: {id: $projectId}){
4953
%s
50-
}}""" % query.results_query_part(Entity.Project)
54+
}}""" % query.results_query_part(Project)
5155
params = {"projectId": self.project_id}
5256
response = self.client.execute(query_str, params)
5357

5458
if response is None:
55-
raise ResourceNotFoundError(Entity.Project, params)
59+
raise ResourceNotFoundError(Project, params)
5660

57-
return Entity.Project(self.client, response["project"])
61+
return Project(self.client, response["project"])
5862

5963
def remove_queued_data_rows(self) -> None:
6064
""" Removes remaining queued data rows from the batch and labeling queue.

0 commit comments

Comments
 (0)