Skip to content

Commit 3861982

Browse files
committed
style
1 parent 1eded91 commit 3861982

File tree

4 files changed

+20
-11
lines changed

4 files changed

+20
-11
lines changed

roboflow/__init__.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
import os
33
import sys
44
import time
5+
from urllib.parse import urlparse
56

67
import requests
7-
from urllib.parse import urlparse
88

99
from roboflow.config import API_URL, APP_URL, DEMO_KEYS, load_roboflow_api_key
1010
from roboflow.core.project import Project
@@ -13,6 +13,7 @@
1313

1414
__version__ = "1.0.0"
1515

16+
1617
def check_key(api_key, model, notebook, num_retries=0):
1718
if type(api_key) is not str:
1819
raise RuntimeError(
@@ -127,8 +128,10 @@ def login(workspace=None, force=False):
127128
# we could eventually return the workspace object here
128129
# return Roboflow().workspace()
129130

131+
130132
active_workspace = None
131133

134+
132135
def initialize_roboflow():
133136
global active_workspace
134137

@@ -138,29 +141,35 @@ def initialize_roboflow():
138141
)
139142

140143
if not os.path.isfile(conf_location):
141-
raise RuntimeError("To use this method, you must first login - run roboflow.login()")
144+
raise RuntimeError(
145+
"To use this method, you must first login - run roboflow.login()"
146+
)
142147
else:
143148
if active_workspace == None:
144149
active_workspace = Roboflow().workspace()
145150

146151
return active_workspace
147152

153+
148154
def load_model(model_url):
149155
operate_workspace = initialize_roboflow()
150-
156+
151157
if "universe.roboflow.com" in model_url or "app.roboflow.com" in model_url:
152158
parsed_url = urlparse(model_url)
153159
path_parts = parsed_url.path.split("/")
154160
project = path_parts[2]
155-
version = int(path_parts[-1])
161+
version = int(path_parts[-1])
156162
else:
157-
raise("Model URL must be from either app.roboflow.com or universe.roboflow.com")
158-
163+
raise (
164+
"Model URL must be from either app.roboflow.com or universe.roboflow.com"
165+
)
166+
159167
project = operate_workspace.project(project)
160168
version = project.version(version)
161169
model = version.model
162170
return model
163171

172+
164173
# continue distributing this object for back compatibility
165174
class Roboflow:
166175
def __init__(

roboflow/config.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ def get_conditional_configuration_variable(key, default):
1313
Returns:
1414
string: The value of the conditional configuration variable.
1515
"""
16-
16+
1717
# default configuration location
1818
conf_location = os.getenv(
19-
"ROBOFLOW_CONFIG_DIR", default=os.getenv("HOME") + "/.config/roboflow/config.json"
19+
"ROBOFLOW_CONFIG_DIR",
20+
default=os.getenv("HOME") + "/.config/roboflow/config.json",
2021
)
2122

2223
# read config file for roboflow if logged in from python or CLI

roboflow/core/project.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,6 @@ def upload(
424424
tag_names: list = [],
425425
**kwargs,
426426
):
427-
428427
"""Upload image function based on the RESTful API
429428
430429
Args:

roboflow/core/version.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
from roboflow.models.instance_segmentation import InstanceSegmentationModel
2929
from roboflow.models.object_detection import ObjectDetectionModel
3030
from roboflow.models.semantic_segmentation import SemanticSegmentationModel
31-
from roboflow.util.general import write_line
3231
from roboflow.util.annotations import amend_data_yaml
32+
from roboflow.util.general import write_line
3333
from roboflow.util.versions import (
3434
get_wrong_dependencies_versions,
3535
print_warn_for_wrong_dependencies_versions,
@@ -432,7 +432,7 @@ def live_plot(epochs, mAP, loss, title=""):
432432

433433
# return the model object
434434
return self.model
435-
435+
436436
# @warn_for_wrong_dependencies_versions([("ultralytics", "<=", "8.0.20")])
437437
def deploy(self, model_type: str, model_path: str) -> None:
438438
"""Uploads provided weights file to Roboflow

0 commit comments

Comments
 (0)