Skip to content

Commit 75ac51b

Browse files
author
Tyler Odenthal
committed
Make style
Sorry for all the updates, forgot to do "make style"
1 parent ca4903c commit 75ac51b

File tree

5 files changed

+21
-39
lines changed

5 files changed

+21
-39
lines changed

roboflow/core/project.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -532,10 +532,6 @@ def single_upload(
532532

533533
def __str__(self):
534534
# String representation of project
535-
json_str = {
536-
"name": self.name,
537-
"type": self.type,
538-
"workspace": self.__workspace,
539-
}
535+
json_str = {"name": self.name, "type": self.type, "workspace": self.__workspace}
540536

541537
return json.dumps(json_str, indent=2)

roboflow/core/version.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,9 @@ def __init__(
9494
local=local,
9595
)
9696
elif self.type == TYPE_INSTANCE_SEGMENTATION:
97-
self.model = InstanceSegmentationModel(
98-
self.__api_key,
99-
self.id,
100-
)
97+
self.model = InstanceSegmentationModel(self.__api_key, self.id)
10198
elif self.type == TYPE_SEMANTIC_SEGMENTATION:
102-
self.model = SemanticSegmentationModel(
103-
self.__api_key,
104-
self.id,
105-
)
99+
self.model = SemanticSegmentationModel(self.__api_key, self.id)
106100
else:
107101
self.model = None
108102

@@ -401,10 +395,7 @@ def __get_format_identifier(self, format):
401395
"You must pass a format argument to version.download() or define a model in your Roboflow object"
402396
)
403397

404-
friendly_formats = {
405-
"yolov5": "yolov5pytorch",
406-
"yolov7": "yolov7pytorch",
407-
}
398+
friendly_formats = {"yolov5": "yolov5pytorch", "yolov7": "yolov7pytorch"}
408399
return friendly_formats.get(format, format)
409400

410401
def __reformat_yaml(self, location, format):

roboflow/models/inference.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@ def __get_image_params(self, image_path):
3131
"""
3232
validate_image_path(image_path)
3333

34-
hosted_image = urllib.parse.urlparse(image_path).scheme in (
35-
"http",
36-
"https",
37-
)
34+
hosted_image = urllib.parse.urlparse(image_path).scheme in ("http", "https")
3835

3936
if hosted_image:
4037
return {"image": image_path}, {}
@@ -45,10 +42,7 @@ def __get_image_params(self, image_path):
4542
data = MultipartEncoder(
4643
fields={"file": ("imageToUpload", buffered.getvalue(), "image/jpeg")}
4744
)
48-
return {}, {
49-
"data": data,
50-
"headers": {"Content-Type": data.content_type},
51-
}
45+
return {}, {"data": data, "headers": {"Content-Type": data.content_type}}
5246

5347
def predict(self, image_path, prediction_type=None, **kwargs):
5448
"""
@@ -71,7 +65,5 @@ def predict(self, image_path, prediction_type=None, **kwargs):
7165
response.raise_for_status()
7266

7367
return PredictionGroup.create_prediction_group(
74-
response.json(),
75-
image_path=image_path,
76-
prediction_type=prediction_type,
68+
response.json(), image_path=image_path, prediction_type=prediction_type
7769
)

roboflow/util/image_utils.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@ def check_image_url(url):
2222
:param url: URL of image
2323
:returns: Boolean
2424
"""
25-
if urllib.parse.urlparse(url).scheme not in (
26-
"http",
27-
"https",
28-
):
25+
if urllib.parse.urlparse(url).scheme not in ("http", "https"):
2926
return False
3027

3128
r = requests.head(url)

roboflow/util/prediction.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,7 @@ def plot_annotation(axes, prediction=None, stroke=1, transparency=60):
8080
elif prediction["prediction_type"] == INSTANCE_SEGMENTATION_MODEL:
8181
points = [[p["x"], p["y"]] for p in prediction["points"]]
8282
polygon = patches.Polygon(
83-
points,
84-
linewidth=stroke,
85-
edgecolor="r",
86-
facecolor="none",
83+
points, linewidth=stroke, edgecolor="r", facecolor="none"
8784
)
8885
axes.add_patch(polygon)
8986
elif prediction["prediction_type"] == SEMANTIC_SEGMENTATION_MODEL:
@@ -500,19 +497,28 @@ def create_prediction_group(json_response, image_path, prediction_type):
500497
)
501498
prediction_list.append(prediction)
502499
if "image" not in json_response:
503-
json_response["image"] = {'width': dimensions[0], 'height': dimensions[1]}
500+
json_response["image"] = {
501+
"width": dimensions[0],
502+
"height": dimensions[1],
503+
}
504504
img_dims = json_response["image"]
505505
elif prediction_type == CLASSIFICATION_MODEL:
506506
prediction = Prediction(json_response, image_path, prediction_type)
507507
prediction_list.append(prediction)
508508
if "image" not in json_response:
509-
json_response["image"] = {'width': dimensions[0], 'height': dimensions[1]}
509+
json_response["image"] = {
510+
"width": dimensions[0],
511+
"height": dimensions[1],
512+
}
510513
img_dims = json_response["image"]
511514
elif prediction_type == SEMANTIC_SEGMENTATION_MODEL:
512515
prediction = Prediction(json_response, image_path, prediction_type)
513516
prediction_list.append(prediction)
514517
if "image" not in json_response:
515-
json_response["image"] = {'width': dimensions[0], 'height': dimensions[1]}
518+
json_response["image"] = {
519+
"width": dimensions[0],
520+
"height": dimensions[1],
521+
}
516522
img_dims = json_response["image"]
517523

518524
# Seperate list and return as a prediction group

0 commit comments

Comments
 (0)