Skip to content

Commit 9ee7e77

Browse files
committed
Auto-formatting servicelib
1 parent da684c4 commit 9ee7e77

15 files changed

+20
-20
lines changed

packages/service-library/src/servicelib/application_setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import inspect
33
import logging
44
from enum import Enum
5-
from typing import Dict, List, Optional, Callable
5+
from typing import Callable, Dict, List, Optional
66

77
from aiohttp import web
88

packages/service-library/src/servicelib/incidents.py

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import attr
44

5-
65
# UTILS ---
76

87
ItemT = TypeVar("ItemT")

packages/service-library/src/servicelib/monitoring.py

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
from aiohttp import web
1717
from prometheus_client import CONTENT_TYPE_LATEST, Counter, Gauge, Histogram
1818

19-
2019
log = logging.getLogger(__name__)
2120

2221

packages/service-library/src/servicelib/resources.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
See https://setuptools.readthedocs.io/en/latest/pkg_resources.html
44
"""
55
import pathlib
6-
import pkg_resources
76
from pathlib import Path
87
from typing import TextIO
8+
99
import attr
10+
import pkg_resources
1011

1112

1213
@attr.s(frozen=True, auto_attribs=True)

packages/service-library/src/servicelib/rest_codecs.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
""" rest - json data encoders/decodes
22
33
"""
4-
import attr
54
import json
65

6+
import attr
7+
78

89
class DataEncoder(json.JSONEncoder):
910
"""

packages/service-library/src/servicelib/rest_models.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
33
UNDER DEVELOPMENT
44
"""
5-
import attr
65
import typing
76
import warnings
87

8+
import attr
99

1010
warnings.warn("DO NOT USE IN PRODUCTION, STILL UNDER DEVELOPMENT")
1111

packages/service-library/src/servicelib/rest_oas.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44
"""
55

66
from aiohttp import web
7-
87
from openapi_core.schema.specs.models import Spec
98

10-
from .openapi import create_specs
119
from .application_keys import APP_OPENAPI_SPECS_KEY
10+
from .openapi import create_specs
1211

1312

1413
def set_specs(app: web.Application, specs: Spec) -> Spec:

packages/service-library/src/servicelib/rest_responses.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
""" Utils to check, convert and compose server responses for the RESTApi
22
33
"""
4-
from typing import Dict, Mapping, Tuple, Optional, List
4+
from typing import Dict, List, Mapping, Optional, Tuple
55

66
import attr
77
from aiohttp import web
88

9-
from .rest_models import LogMessageType
10-
from .rest_codecs import jsonify, json
11-
from .rest_models import ErrorItemType, ErrorType
9+
from .rest_codecs import json, jsonify
10+
from .rest_models import ErrorItemType, ErrorType, LogMessageType
1211

1312
ENVELOPE_KEYS = ("data", "error")
1413
JSON_CONTENT_TYPE = "application/json"

packages/service-library/src/servicelib/utils.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -83,20 +83,18 @@ async def logged_gather(
8383
"""
8484
results = await asyncio.gather(*tasks, return_exceptions=True)
8585

86-
8786
error = None
8887
for i, value in enumerate(results):
8988
if isinstance(value, Exception):
9089
log.warning(
9190
"Error in %i-th concurrent task %s: %s",
92-
i+1,
91+
i + 1,
9392
str(tasks[i]),
9493
str(value),
9594
)
9695
if not error:
9796
error = value
9897

99-
10098
if reraise and error:
10199
# WARNING: Notice that ONLY THE FIRST exception is raised.
102100
# The rest is all logged above.

packages/service-library/tests/conftest.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
import sys
66
from pathlib import Path
77

8+
import pytest
89
import yaml
10+
911
import servicelib
1012
from servicelib.openapi import create_openapi_specs
1113

12-
import pytest
13-
1414

1515
@pytest.fixture(scope="session")
1616
def here():

packages/service-library/tests/test_incidents_monitoring.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77

88
import pytest
99

10+
from servicelib import monitor_slow_callbacks
1011
from servicelib.aiopg_utils import (
1112
DatabaseError,
1213
postgres_service_retry_policy_kwargs,
1314
retry,
1415
)
15-
from servicelib import monitor_slow_callbacks
1616

1717

1818
async def slow_task(delay):

packages/service-library/tests/test_package.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
from pathlib import Path
88

99
import pytest
10-
from servicelib.utils import is_osparc_repo_dir, search_osparc_repo_dir
10+
1111
from pytest_simcore.helpers.utils_pylint import assert_pylint_is_passing
12+
from servicelib.utils import is_osparc_repo_dir, search_osparc_repo_dir
1213

1314

1415
@pytest.fixture

packages/service-library/tests/test_rest_middlewares.py

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import pytest
66
from aiohttp import web
7+
78
from servicelib import openapi
89
from servicelib.application_keys import APP_OPENAPI_SPECS_KEY
910
from servicelib.rest_middlewares import (

packages/service-library/tests/tutils.py

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import attr
88
from aiohttp import web
9+
910
from servicelib.rest_codecs import DataEncoder
1011

1112

packages/service-library/tests/with_postgres/test_aiopg_utils.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# pylint:disable=too-many-arguments
44
# pylint:disable=broad-except
55

6+
import asyncio
67
import logging
78
import sys
89
from copy import deepcopy
@@ -13,7 +14,7 @@
1314
import pytest
1415
import sqlalchemy as sa
1516
from aiohttp import web
16-
import asyncio
17+
1718
from servicelib.aiopg_utils import (
1819
DatabaseError,
1920
DataSourceName,

0 commit comments

Comments
 (0)