Skip to content

Commit 5487639

Browse files
authored
Merge pull request #279 from roboflow/iuri/fix-mypy-again
Fix types in version init
2 parents 813d56f + 03757f0 commit 5487639

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

roboflow/core/version.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,14 @@ 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+
if response.ok:
106+
version_info = response.json()["version"]
107+
has_model = bool(version_info.get("models"))
108+
else:
109+
has_model = False
109110

110-
if ("models" in version_info) and (not version_info["models"]):
111+
if not has_model:
111112
self.model = None
112113
elif self.type == TYPE_OBJECT_DETECTION:
113114
self.model = ObjectDetectionModel(

0 commit comments

Comments
 (0)