Skip to content

Commit f04b807

Browse files
Vaghinak BasentsyanVaghinak Basentsyan
authored andcommitted
Fixed uplaod_images_from_public_urls
1 parent 15aa09d commit f04b807

File tree

9 files changed

+164
-183
lines changed

9 files changed

+164
-183
lines changed

pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
minversion = 3.0
33
log_cli=true
44
python_files = test_*.py
5-
;addopts = -n32 --dist=loadscope
5+
addopts = -n32 --dist=loadscope

src/superannotate/lib/app/helpers.py

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
from ast import literal_eval
2-
from functools import wraps
3-
from inspect import getfullargspec
42
from pathlib import Path
5-
from typing import get_type_hints
63
from typing import List
74
from typing import Optional
85
from typing import Tuple
96
from typing import Union
107

118
import boto3
129
import pandas as pd
13-
from lib.core.exceptions import AppValidationException
1410
from superannotate.lib.app.exceptions import PathError
1511
from superannotate.lib.core import PIXEL_ANNOTATION_POSTFIX
1612
from superannotate.lib.core import VECTOR_ANNOTATION_POSTFIX
@@ -121,45 +117,3 @@ def metric_is_plottable(key):
121117
if key == "total_loss" or "mIoU" in key or "mAP" in key or key == "iteration":
122118
return True
123119
return False
124-
125-
126-
def check_types(obj, **kwargs):
127-
hints = get_type_hints(obj)
128-
129-
errors = []
130-
for attr_name, attr_type in hints.items():
131-
if attr_name == "return":
132-
continue
133-
try:
134-
if getattr(attr_type, "__origin__") and attr_type.__origin__ is list:
135-
if attr_type.__args__:
136-
for elem in kwargs[attr_name]:
137-
if type(elem) in attr_type.__args__:
138-
continue
139-
else:
140-
errors.append(f"Invalid input {attr_name}")
141-
elif not isinstance(kwargs[attr_name], list):
142-
errors.append(f"Argument {attr_name} is not of type {attr_type}")
143-
elif getattr(attr_type, "__origin__") and attr_type.__origin__ is Union:
144-
if kwargs.get(attr_name) and not isinstance(
145-
kwargs[attr_name], attr_type.__args__
146-
):
147-
errors.append(f"Argument {attr_name} is not of type {attr_type}")
148-
elif kwargs.get(attr_name) and not isinstance(kwargs[attr_name], attr_type):
149-
errors.append(f"Argument {attr_name} is not of type {attr_type}")
150-
except Exception as _:
151-
pass
152-
return errors
153-
154-
155-
def validate_input(decorator):
156-
@wraps(decorator)
157-
def wrapped_decorator(*args, **kwargs):
158-
func_args = getfullargspec(decorator)[0]
159-
kwargs.update(dict(zip(func_args, args)))
160-
errors = check_types(decorator, **kwargs)
161-
if errors:
162-
raise AppValidationException("\n".join(errors))
163-
return decorator(**kwargs)
164-
165-
return wrapped_decorator

0 commit comments

Comments
 (0)