Skip to content

Commit f408441

Browse files
committed
Fix types in version init
1 parent 813d56f commit f408441

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

roboflow/core/version.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,12 @@ def __init__(
101101

102102
version_without_workspace = os.path.basename(str(version))
103103

104-
version_info = requests.get(f"{API_URL}/{workspace}/{project}/{self.version}?api_key={self.__api_key}")
105-
106-
# check if version has a model
107-
if version_info.status_code == 200:
108-
version_info = version_info.json()["version"]
104+
response = requests.get(f"{API_URL}/{workspace}/{project}/{self.version}?api_key={self.__api_key}")
105+
response.raise_for_status()
106+
version_info = response.json()["version"]
107+
has_model = bool(version_info.get("models"))
109108

110-
if ("models" in version_info) and (not version_info["models"]):
109+
if not has_model:
111110
self.model = None
112111
elif self.type == TYPE_OBJECT_DETECTION:
113112
self.model = ObjectDetectionModel(

0 commit comments

Comments
 (0)