Skip to content

Commit 7643314

Browse files
authored
Merge pull request #712 from superannotateai/FRIDAY_3118
Friday 3118
2 parents 4ea760c + dd30f75 commit 7643314

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+2562
-1619
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ __pycache__/
1313
# Distribution / packaging
1414
.Python
1515
build/
16+
1617
develop-eggs/
1718
dist/
1819
downloads/

.pre-commit-config.yaml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: 'https://github.com/asottile/reorder_python_imports'
3-
rev: v2.3.0
3+
rev: v3.13.0
44
hooks:
55
- id: reorder-python-imports
66
exclude: src/lib/app/analytics | src/lib/app/converters | src/lib/app/input_converters
@@ -21,7 +21,7 @@ repos:
2121
name: Style Guide Enforcement (flake8)
2222
args:
2323
- '--max-line-length=120'
24-
- --ignore=D100,D203,D405,W503,E203,E501,F841,E126,E712,E123,E131,F821,E121,W605
24+
- --ignore=D100,D203,D405,W503,E203,E501,F841,E126,E712,E123,E131,F821,E121,W605,E402
2525
- repo: 'https://github.com/asottile/pyupgrade'
2626
rev: v2.4.3
2727
hooks:
@@ -48,6 +48,19 @@ repos:
4848
- id: trailing-whitespace
4949
- id: end-of-file-fixer
5050
files: \.rst$
51+
# - repo: https://github.com/pre-commit/mirrors-mypy
52+
# rev: v1.11.2
53+
# hooks:
54+
# - id: mypy
55+
# additional_dependencies: [ types-six ]
56+
# - repo: 'https://github.com/PyCQA/pylint'
57+
# rev: v2.13.9
58+
# hooks:
59+
# - id: pylint
60+
# name: Python Linter (pylint)
61+
# exclude: tests/|src/lib/app/converters/|src/lib/app/analytics/|src/lib/app/input_converters/
62+
# args:
63+
# - '--disable=R0903,C0111,C0301,W0703,R0914,R0801,R0913,E0401,W0511,C0413,R0902,C0103,W0201,C0209,W1203,W0707,C0415,W0611'
5164
# - repo: 'https://github.com/asottile/dead'
5265
# rev: v1.3.0
5366
# hooks:

.pylintrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[VARIABLES]
2+
good-names=i,j,k,e,x,y,z,a,b,f,sa

docs/source/api_reference/api_item.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Items
55

66
.. automethod:: superannotate.SAClient.query
77
.. automethod:: superannotate.SAClient.get_item_by_id
8+
.. automethod:: superannotate.SAClient.list_items
89
.. automethod:: superannotate.SAClient.search_items
910
.. automethod:: superannotate.SAClient.attach_items
1011
.. automethod:: superannotate.SAClient.copy_items

docs/source/api_reference/api_metadata.rst

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,21 @@ Project metadata example:
2828
}
2929
3030
31+
----------
32+
33+
Folder metadata
34+
_________________
35+
36+
Folder metadata example:
37+
38+
.. code-block:: python
39+
40+
{
41+
"name": "Example folder",
42+
"status": "NotStarted"
43+
}
44+
45+
3146
----------
3247

3348
Setting metadata
@@ -114,8 +129,6 @@ Image metadata example:
114129
{
115130
"name": "000000000001.jpg",
116131
"annotation_status": "Completed",
117-
"prediction_status": "NotStarted",
118-
"segmentation_status": "NotStarted",
119132
"annotator_id": None,
120133
"annotator_name": None,
121134
"qa_id": None,

docs/source/api_reference/api_project.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,7 @@ Projects
2222
.. automethod:: superannotate.SAClient.add_contributors_to_project
2323
.. automethod:: superannotate.SAClient.get_project_settings
2424
.. automethod:: superannotate.SAClient.set_project_default_image_quality_in_editor
25+
.. automethod:: superannotate.SAClient.set_project_steps
26+
.. automethod:: superannotate.SAClient.get_project_steps
2527
.. automethod:: superannotate.SAClient.set_project_workflow
2628
.. automethod:: superannotate.SAClient.get_project_workflow

pytest.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,3 @@ log_cli=true
44
python_files = test_*.py
55
;pytest_plugins = ['pytest_profiling']
66
;addopts = -n auto --dist=loadscope
7-

setup.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66

77

88
def get_version():
9-
init = open(
9+
with open(
1010
os.path.join(os.path.dirname(__file__), "src", "superannotate", "__init__.py")
11-
).read()
12-
version_re = re.compile(
13-
r"""__version__ = ["']((\d+)\.(\d+)\.(\d+)((dev(\d+))?(b(\d+))?))['"]"""
14-
)
15-
return version_re.search(init).group(1)
11+
) as f:
12+
init = f.read()
13+
version_re = re.compile(
14+
r"""__version__ = ["']((\d+)\.(\d+)\.(\d+)((dev(\d+))?(b(\d+))?))['"]"""
15+
)
16+
return version_re.search(init).group(1)
1617

1718

1819
sdk_version = get_version()
@@ -22,6 +23,8 @@ def get_version():
2223
with open("requirements.txt") as f:
2324
requirements.extend(f.read().splitlines())
2425

26+
with open("README.rst") as f:
27+
long_description = f.read()
2528

2629
setup(
2730
name="superannotate",
@@ -38,7 +41,7 @@ def get_version():
3841
author="SuperAnnotate AI",
3942
author_email="support@superannotate.com",
4043
url="https://github.com/superannotateai/superannotate-python-sdk",
41-
long_description=open("README.rst").read(),
44+
long_description=long_description,
4245
long_description_content_type="text/x-rst",
4346
install_requires=requirements,
4447
setup_requires=["wheel"],

src/superannotate/__init__.py

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@
33
import sys
44

55

6-
__version__ = "4.4.24"
6+
__version__ = "4.4.25dev1"
77

8+
os.environ.update({"sa_version": __version__})
89
sys.path.append(os.path.split(os.path.realpath(__file__))[0])
910

10-
import logging.config # noqa
11-
import requests # noqa
12-
from packaging.version import parse # noqa
13-
from superannotate.lib.app.input_converters import convert_project_type # noqa
14-
from superannotate.lib.app.exceptions import AppException # noqa
15-
from superannotate.lib.app.input_converters import convert_project_type # noqa
16-
from superannotate.lib.app.input_converters import export_annotation # noqa
17-
from superannotate.lib.app.input_converters import import_annotation # noqa
18-
from superannotate.lib.app.interface.sdk_interface import SAClient # noqa
19-
from superannotate.lib.core import PACKAGE_VERSION_INFO_MESSAGE # noqa
20-
from superannotate.lib.core import PACKAGE_VERSION_MAJOR_UPGRADE # noqa
21-
from superannotate.lib.core import PACKAGE_VERSION_UPGRADE # noqa
22-
import superannotate.lib.core.enums as enums # noqa
11+
import requests
12+
from lib.core import enums
13+
from packaging.version import parse
14+
from lib.core import PACKAGE_VERSION_UPGRADE
15+
from lib.core import PACKAGE_VERSION_INFO_MESSAGE
16+
from lib.core import PACKAGE_VERSION_MAJOR_UPGRADE
17+
from lib.core.exceptions import AppException
18+
from lib.app.input_converters import convert_project_type
19+
from lib.app.input_converters import export_annotation
20+
from lib.app.input_converters import import_annotation
21+
from lib.app.interface.sdk_interface import SAClient
22+
2323

2424
SESSIONS = {}
2525

@@ -30,7 +30,6 @@
3030
# Utils
3131
"enums",
3232
"AppException",
33-
# converters
3433
"import_annotation",
3534
"export_annotation",
3635
"convert_project_type",
@@ -62,5 +61,5 @@ def log_version_info():
6261
logging.warning(PACKAGE_VERSION_UPGRADE.format(local_version, pip_version))
6362

6463

65-
if not os.environ.get("SA_VERSION_CHECK", "True").lower() == "false":
64+
if os.environ.get("SA_VERSION_CHECK", "True").lower() != "false":
6665
log_version_info()

src/superannotate/lib/app/analytics/aggregators.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

1010
import lib.core as constances
1111
import pandas as pd
12-
from lib.app.exceptions import AppException
1312
from lib.core import PIXEL_ANNOTATION_POSTFIX
1413
from lib.core import VECTOR_ANNOTATION_POSTFIX
14+
from lib.core.exceptions import AppException
1515

1616
logger = logging.getLogger("sa")
1717

@@ -210,16 +210,16 @@ def aggregate_annotations_as_df(self):
210210
constances.ProjectType.PIXEL,
211211
):
212212
return self.aggregate_image_annotations_as_df(annotation_paths)
213-
elif self.project_type is constances.ProjectType.VIDEO:
213+
if self.project_type is constances.ProjectType.VIDEO:
214214
return self.aggregate_video_annotations_as_df(annotation_paths)
215-
elif self.project_type is constances.ProjectType.DOCUMENT:
215+
if self.project_type is constances.ProjectType.DOCUMENT:
216216
return self.aggregate_document_annotations_as_df(annotation_paths)
217-
else:
218-
raise AppException(
219-
f"The function is not supported for {self.project_type.name} projects."
220-
)
217+
raise AppException(
218+
f"The function is not supported for {self.project_type.name} projects."
219+
)
221220

222-
def __add_attributes_to_raws(self, raws, attributes, element_raw):
221+
@staticmethod
222+
def __add_attributes_to_raws(raws, attributes, element_raw):
223223
for attribute_id, attribute in enumerate(attributes):
224224
attribute_raw = copy.copy(element_raw)
225225
attribute_raw.attributeId = attribute_id
@@ -366,8 +366,8 @@ def aggregate_document_annotations_as_df(self, annotation_paths: List[str]):
366366
return df.where(pd.notnull(df), None)
367367

368368
def aggregate_image_annotations_as_df(self, annotations_paths: List[str]):
369-
370-
classes_json = json.load(open(self.classes_path))
369+
with open(self.classes_path) as f:
370+
classes_json = json.load(f)
371371
class_name_to_color = {}
372372
class_group_name_to_values = {}
373373
rows = []

0 commit comments

Comments
 (0)