Skip to content

Commit da6afa7

Browse files
committed
LITE-25845 Add isort
* Add isort library and settings * Remove flake8-import-order * Run isort * Fix build.yml * Add isort run information to the README.md
1 parent 5a1aad0 commit da6afa7

File tree

82 files changed

+249
-237
lines changed

Some content is hidden

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

82 files changed

+249
-237
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
strategy:
1717
matrix:
18-
python-version: [3.7, 3.8]
18+
python-version: ['3.7', '3.8']
1919
steps:
2020
- name: Checkout
2121
uses: actions/checkout@v2
@@ -73,7 +73,7 @@ jobs:
7373
runs-on: ubuntu-latest
7474
strategy:
7575
matrix:
76-
python-version: [3.10.1]
76+
python-version: ['3.10']
7777
steps:
7878
- name: Checkout
7979
uses: actions/checkout@v2
@@ -105,10 +105,10 @@ jobs:
105105
uses: actions/checkout@v2
106106
with:
107107
fetch-depth: 0
108-
- name: Set up Python '3.10.0'
108+
- name: Set up Python '3.10'
109109
uses: actions/setup-python@v2
110110
with:
111-
python-version: '3.10.0'
111+
python-version: ['3.10']
112112
- name: Install dependencies
113113
run: |
114114
python -m pip install --upgrade pip
@@ -145,10 +145,10 @@ jobs:
145145
uses: actions/checkout@v2
146146
with:
147147
fetch-depth: 0
148-
- name: Set up Python '3.10.0'
148+
- name: Set up Python '3.10'
149149
uses: actions/setup-python@v2
150150
with:
151-
python-version: '3.10.0'
151+
python-version: ['3.10']
152152
- name: Integration tests
153153
env:
154154
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,10 @@ Development
210210
===========
211211

212212
1. Python 3.7 +
213-
0. Install dependencies `requirements/dev.txt`
213+
2. Install dependencies `requirements/dev.txt`
214+
3. We use `isort` library to order and format our imports, and we check it using `flake8-isort` library (automatically on `flake8` run).
215+
For convenience you may run `poetry isort .` to order imports.
216+
214217

215218
Testing
216219
=======

dj_cqrs/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22

33
import django # pragma: no cover
44

5+
56
if django.VERSION < (3, 2): # pragma: no cover
67
default_app_config = 'dj_cqrs.apps.CQRSConfig'

dj_cqrs/_validation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import logging
44
from inspect import getfullargspec, isfunction
55

6+
from django.utils.module_loading import import_string
7+
68
from dj_cqrs.constants import (
79
DEFAULT_MASTER_AUTO_UPDATE_FIELDS,
810
DEFAULT_MASTER_MESSAGE_TTL,
@@ -13,8 +15,6 @@
1315
from dj_cqrs.registries import MasterRegistry, ReplicaRegistry
1416
from dj_cqrs.transport import BaseTransport
1517

16-
from django.utils.module_loading import import_string
17-
1818

1919
logger = logging.getLogger('django-cqrs')
2020

dj_cqrs/apps.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Copyright © 2021 Ingram Micro Inc. All rights reserved.
22

3-
from dj_cqrs._validation import validate_settings
4-
53
from django.apps import AppConfig
64
from django.conf import settings
75

6+
from dj_cqrs._validation import validate_settings
7+
88

99
class CQRSConfig(AppConfig):
1010
name = 'dj_cqrs'

dj_cqrs/controller/consumer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
import logging
55
from contextlib import ExitStack
66

7+
from django.db import Error, close_old_connections, transaction
8+
79
from dj_cqrs.constants import SignalType
810
from dj_cqrs.registries import ReplicaRegistry
911

10-
from django.db import Error, close_old_connections, transaction
11-
1212

1313
logger = logging.getLogger('django-cqrs')
1414

dj_cqrs/dataclasses.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
# Copyright © 2022 Ingram Micro Inc. All rights reserved.
22

33
from dateutil.parser import parse as dateutil_parse
4+
from django.utils import timezone
45

56
from dj_cqrs.correlation import get_correlation_id
67
from dj_cqrs.utils import get_json_valid_value, get_message_expiration_dt
78

8-
from django.utils import timezone
9-
109

1110
class TransportPayload:
1211
"""Transport message payload.

dj_cqrs/management/commands/cqrs_bulk_dump.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@
55
import sys
66
import time
77

8-
from dj_cqrs.management.utils import batch_qs
9-
from dj_cqrs.registries import MasterRegistry
10-
8+
import ujson
119
from django.core.management.base import BaseCommand, CommandError
1210

13-
import ujson
11+
from dj_cqrs.management.utils import batch_qs
12+
from dj_cqrs.registries import MasterRegistry
1413

1514

1615
class Command(BaseCommand):

dj_cqrs/management/commands/cqrs_bulk_load.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33
import os
44
import sys
55

6-
from dj_cqrs.registries import ReplicaRegistry
7-
6+
import ujson
87
from django.core.management.base import BaseCommand, CommandError
98
from django.db import DatabaseError, transaction
109

11-
import ujson
10+
from dj_cqrs.registries import ReplicaRegistry
1211

1312

1413
class Command(BaseCommand):

dj_cqrs/management/commands/cqrs_consume.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
import multiprocessing
33
import signal
44

5+
from django.core.management.base import BaseCommand, CommandError
6+
57
from dj_cqrs.registries import ReplicaRegistry
68
from dj_cqrs.transport import current_transport
79

8-
from django.core.management.base import BaseCommand, CommandError
9-
1010

1111
class WorkersManager:
1212

0 commit comments

Comments
 (0)