Skip to content

Commit 3a5387e

Browse files
authored
Merge pull request #366 from superannotateai/friday
Friday
2 parents 52f13e4 + 8f61bd8 commit 3a5387e

File tree

77 files changed

+765
-1379
lines changed

Some content is hidden

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

77 files changed

+765
-1379
lines changed

.devcontainer/devcontainer.json

Lines changed: 0 additions & 12 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
repos:
2+
- repo: 'https://github.com/asottile/reorder_python_imports'
3+
rev: v2.3.0
4+
hooks:
5+
- id: reorder-python-imports
6+
exclude: src/lib/app/analytics | src/lib/app/converters | src/lib/app/input_converters
7+
name: 'Reorder Python imports (src, tests)'
8+
args:
9+
- '--application-directories'
10+
- app
11+
- repo: 'https://github.com/python/black'
12+
rev: 19.10b0
13+
hooks:
14+
- id: black
15+
name: Code Formatter (black)
216
- repo: 'https://gitlab.com/pycqa/flake8'
317
rev: 3.8.2
418
hooks:
@@ -7,7 +21,7 @@ repos:
721
name: Style Guide Enforcement (flake8)
822
args:
923
- '--max-line-length=120'
10-
- --ignore=D100,D203,D405,W503,E203,E501,F841,E126,E712
24+
- --ignore=D100,D203,D405,W503,E203,E501,F841,E126,E712,E123,E131,F821,E121
1125
- repo: 'https://github.com/asottile/pyupgrade'
1226
rev: v2.4.3
1327
hooks:
@@ -16,26 +30,12 @@ repos:
1630
name: Upgrade syntax for newer versions of the language (pyupgrade)
1731
args:
1832
- '--py37-plus'
19-
- repo: 'https://github.com/asottile/reorder_python_imports'
20-
rev: v2.3.0
21-
hooks:
22-
- id: reorder-python-imports
23-
exclude: src/lib/app/analytics | src/lib/app/converters | src/lib/app/input_converters
24-
name: 'Reorder Python imports (src, tests)'
25-
args:
26-
- '--application-directories'
27-
- app
2833
- repo: 'https://github.com/pre-commit/pre-commit-hooks'
2934
rev: v3.1.0
3035
hooks:
3136
- id: check-byte-order-marker
3237
- id: trailing-whitespace
3338
- id: end-of-file-fixer
34-
- repo: 'https://github.com/python/black'
35-
rev: 19.10b0
36-
hooks:
37-
- id: black
38-
name: Uncompromising Code Formatter (black)
3939
# - repo: 'https://github.com/asottile/dead'
4040
# rev: v1.3.0
4141
# hooks:

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 = -n auto --dist=lo adscope
5+
;addopts = -n auto --dist=loads cope

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ fire==0.4.0
1717
mixpanel==4.8.3
1818
pydantic>=1.8.2
1919
pydantic[email]
20-
setuptools~=57.4.0
20+
setuptools~=57.4.0
21+
superannotate_schemas

requirements_dev.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ pytest==6.2.4
44
pytest-xdist==2.3.0
55
pytest-parallel==0.1.0
66
pytest-rerunfailures==10.2
7-
sphinx_rtd_theme==1.0.0
7+
sphinx_rtd_theme==1.0.0
8+

src/superannotate/__init__.py

Lines changed: 5 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import logging.config
22
import os
33
import sys
4-
from os.path import expanduser
54

65
import requests
76
import superannotate.lib.core as constances
@@ -107,6 +106,7 @@
107106
upload_videos_from_folder_to_project,
108107
)
109108
from superannotate.lib.app.interface.sdk_interface import validate_annotations
109+
from superannotate.logger import get_default_logger
110110
from superannotate.version import __version__
111111

112112
__all__ = [
@@ -208,48 +208,13 @@
208208
WORKING_DIR = os.path.split(os.path.realpath(__file__))[0]
209209
sys.path.append(WORKING_DIR)
210210
logging.getLogger("botocore").setLevel(logging.CRITICAL)
211-
212-
logging.config.dictConfig(
213-
{
214-
"version": 1,
215-
"disable_existing_loggers": False,
216-
"handlers": {
217-
"console": {
218-
"class": "logging.StreamHandler",
219-
"level": "INFO",
220-
"formatter": "consoleFormatter",
221-
"stream": "ext://sys.stdout",
222-
},
223-
"fileHandler": {
224-
"class": "logging.handlers.RotatingFileHandler",
225-
"level": "DEBUG",
226-
"formatter": "fileFormatter",
227-
"filename": expanduser(constances.LOG_FILE_LOCATION),
228-
"mode": "a",
229-
"maxBytes": 5 * 1024 * 1024,
230-
"backupCount": 5,
231-
},
232-
},
233-
"formatters": {
234-
"consoleFormatter": {
235-
"format": "SA-PYTHON-SDK - %(levelname)s - %(message)s",
236-
},
237-
"fileFormatter": {
238-
"format": "SA-PYTHON-SDK - %(levelname)s - %(asctime)s - %(message)s"
239-
},
240-
},
241-
"root": { # root logger
242-
"level": "DEBUG",
243-
"handlers": ["console", "fileHandler"],
244-
},
245-
}
246-
)
211+
logger = get_default_logger()
247212

248213

249214
def log_version_info():
250215
local_version = parse(__version__)
251216
if local_version.is_prerelease:
252-
logging.info(constances.PACKAGE_VERSION_INFO_MESSAGE.format(__version__))
217+
logger.info(constances.PACKAGE_VERSION_INFO_MESSAGE.format(__version__))
253218
req = requests.get("https://pypi.python.org/pypi/superannotate/json")
254219
if req.ok:
255220
releases = req.json().get("releases", [])
@@ -259,13 +224,13 @@ def log_version_info():
259224
if not ver.is_prerelease or local_version.is_prerelease:
260225
pip_version = max(pip_version, ver)
261226
if pip_version.major > local_version.major:
262-
logging.warning(
227+
logger.warning(
263228
constances.PACKAGE_VERSION_MAJOR_UPGRADE.format(
264229
local_version, pip_version
265230
)
266231
)
267232
elif pip_version > local_version:
268-
logging.warning(
233+
logger.warning(
269234
constances.PACKAGE_VERSION_UPGRADE.format(local_version, pip_version)
270235
)
271236

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import copy
22
import json
3-
import logging
43
from pathlib import Path
54
from typing import List
65
from typing import Optional
@@ -13,8 +12,9 @@
1312
from lib.core import ATTACHED_VIDEO_ANNOTATION_POSTFIX
1413
from lib.core import PIXEL_ANNOTATION_POSTFIX
1514
from lib.core import VECTOR_ANNOTATION_POSTFIX
15+
from superannotate.logger import get_default_logger
1616

17-
logger = logging.getLogger("root")
17+
logger = get_default_logger()
1818

1919

2020
@dataclass

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
import logging
21
from pathlib import Path
32

43
import pandas as pd
54
import plotly.express as px
65
from lib.app.mixp.decorators import Trackable
76
from superannotate.lib.app.exceptions import AppException
87
from superannotate.lib.core import DEPRICATED_DOCUMENT_VIDEO_MESSAGE
8+
from superannotate.logger import get_default_logger
99

1010
from .common import aggregate_image_annotations_as_df
1111

12-
logger = logging.getLogger()
12+
logger = get_default_logger()
1313

1414

1515
@Trackable

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import json
2-
import logging
32
from pathlib import Path
43

54
import pandas as pd
65
import plotly.express as px
76
from lib.app.exceptions import AppException
87
from lib.core import DEPRICATED_DOCUMENT_VIDEO_MESSAGE
8+
from superannotate.logger import get_default_logger
99

1010

11-
logger = logging.getLogger("root")
11+
logger = get_default_logger()
1212

1313

1414
def aggregate_image_annotations_as_df(
@@ -412,9 +412,7 @@ def image_consensus(df, image_name, annot_type):
412412
"""
413413

414414
try:
415-
from shapely.geometry import box
416-
from shapely.geometry import Point
417-
from shapely.geometry import Polygon
415+
from shapely.geometry import Point, Polygon, box
418416
except ImportError:
419417
raise ImportError(
420418
"To use superannotate.benchmark or superannotate.consensus functions please install "

src/superannotate/lib/app/bin/superannotate.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
#!/usr/bin/env python3
2-
import logging
3-
42
import fire
53
from lib.app.interface.cli_interface import CLIFacade
4+
from superannotate.logger import get_default_logger
65

7-
logger = logging.getLogger()
6+
logger = get_default_logger()
87

98

109
def main():

0 commit comments

Comments
 (0)