Skip to content

Commit 0906fab

Browse files
committed
Switch to absolute imports
They are more readable.
1 parent c76686e commit 0906fab

File tree

12 files changed

+41
-35
lines changed

12 files changed

+41
-35
lines changed

newdle/api.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,26 @@
2222
from sqlalchemy.orm import selectinload
2323
from werkzeug.exceptions import Forbidden, ServiceUnavailable, UnprocessableEntity
2424

25-
from .answers import validate_answers
26-
from .calendar import create_calendar_event
27-
from .core.auth import search_users, user_info_from_app_token
28-
from .core.db import db
29-
from .core.util import (
25+
from newdle.answers import validate_answers
26+
from newdle.calendar import create_calendar_event
27+
from newdle.core.auth import search_users, user_info_from_app_token
28+
from newdle.core.db import db
29+
from newdle.core.util import (
3030
DATE_FORMAT,
3131
avatar_info_from_payload,
3232
change_dt_timezone,
3333
range_union,
3434
render_user_avatar,
3535
)
36-
from .core.webargs import abort, use_args, use_kwargs
37-
from .export import export_answers_to_csv, export_answers_to_xlsx
38-
from .models import Availability, Newdle, Participant, StatKey, Stats
39-
from .notifications import (
36+
from newdle.core.webargs import abort, use_args, use_kwargs
37+
from newdle.export import export_answers_to_csv, export_answers_to_xlsx
38+
from newdle.models import Availability, Newdle, Participant, StatKey, Stats
39+
from newdle.notifications import (
4040
notify_newdle_creator,
4141
notify_newdle_participants,
4242
send_invitation_emails,
4343
)
44-
from .schemas import (
44+
from newdle.schemas import (
4545
DeletedNewdleSchema,
4646
MyNewdleSchema,
4747
NewdleParticipantSchema,

newdle/auth.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from flask import Blueprint, current_app, redirect, render_template, session, url_for
22

3-
from .core.auth import app_token_from_dummy, multipass
3+
from newdle.core.auth import app_token_from_dummy, multipass
44

55
auth = Blueprint('auth', __name__)
66

newdle/cli.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@
55
from flask import Blueprint, current_app
66
from sqlalchemy import and_, or_
77

8-
from .core.db import db
9-
from .models import Newdle
10-
from .providers.free_busy.util import get_msal_app, get_msal_token, save_msal_cache
8+
from newdle.core.db import db
9+
from newdle.models import Newdle
10+
from newdle.providers.free_busy.util import (
11+
get_msal_app,
12+
get_msal_token,
13+
save_msal_cache,
14+
)
1115

1216
try:
1317
import exchangelib

newdle/core/app.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
from werkzeug.exceptions import HTTPException
55
from werkzeug.middleware.proxy_fix import ProxyFix
66

7-
from ..api import api
8-
from ..auth import auth
9-
from ..cli import cli
10-
from .auth import multipass
11-
from .cache import cache
12-
from .db import db, migrate
13-
from .marshmallow import mm
14-
from .util import dedent
7+
from newdle.api import api
8+
from newdle.auth import auth
9+
from newdle.cli import cli
10+
from newdle.core.auth import multipass
11+
from newdle.core.cache import cache
12+
from newdle.core.db import db, migrate
13+
from newdle.core.marshmallow import mm
14+
from newdle.core.util import dedent
1515

1616

1717
def _configure_app(app, from_env=True):

newdle/core/auth.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from flask import current_app, render_template
22
from flask_multipass import Multipass
33

4-
from .util import secure_timed_serializer
4+
from newdle.core.util import secure_timed_serializer
55

66

77
class NewdleMultipass(Multipass):

newdle/models.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
from sqlalchemy.ext.hybrid import hybrid_property
99
from sqlalchemy.schema import CheckConstraint
1010

11-
from .core.db import db
12-
from .core.util import AutoNameEnum, format_dt, parse_dt
11+
from newdle.core.db import db
12+
from newdle.core.util import AutoNameEnum, format_dt, parse_dt
1313

1414
CODE_ALPHABET = '23456789bcdfghjkmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ'
1515

newdle/notifications.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from flask import current_app, g, render_template, url_for
22

3-
from .vendor.django_mail import get_connection
4-
from .vendor.django_mail.message import EmailMultiAlternatives
3+
from newdle.vendor.django_mail import get_connection
4+
from newdle.vendor.django_mail.message import EmailMultiAlternatives
55

66

77
def send_invitation_emails(newdle, participants=None):

newdle/providers/free_busy/exchange.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
from oauthlib.oauth2.rfc6749.tokens import OAuth2Token
2020
from werkzeug.exceptions import ServiceUnavailable
2121

22-
from ...core.util import find_overlap
23-
from .util import get_msal_token
22+
from newdle.core.util import find_overlap
23+
from newdle.providers.free_busy.util import get_msal_token
2424

2525
TYPE_MAP = {'Busy': 'busy', 'Tentative': 'busy', 'OOF': 'busy'}
2626

newdle/providers/free_busy/ox.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from flask import current_app
77
from requests.models import HTTPBasicAuth
88

9-
from ...core.util import find_overlap
9+
from newdle.core.util import find_overlap
1010

1111

1212
def fetch_free_busy(date, tz, uid, email):

newdle/providers/free_busy/random.py

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

55
import pytz
66

7-
from ...core.util import find_overlap
7+
from newdle.core.util import find_overlap
88

99

1010
def fetch_free_busy(date, tz, uid, email):

newdle/schemas.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
from marshmallow_enum import EnumField
1313
from pytz import common_timezones_set
1414

15-
from .core.marshmallow import mm
16-
from .core.util import (
15+
from newdle.core.marshmallow import mm
16+
from newdle.core.util import (
1717
DATETIME_FORMAT,
1818
avatar_payload_from_participant,
1919
avatar_payload_from_user_info,
2020
check_user_signature,
2121
sign_user,
2222
)
23-
from .models import Availability
23+
from newdle.models import Availability
2424

2525

2626
class UserSchema(mm.Schema):

ruff.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ ignore = [
9393
'PLW0603', # globals are fine here
9494
'COM812', # formatter conflict
9595
'ISC001', # formatter conflict
96-
'TID252', # later
9796
]
9897

9998
extend-safe-fixes = [
@@ -123,6 +122,9 @@ parametrize-names-type = 'tuple'
123122
parametrize-values-type = 'tuple'
124123
parametrize-values-row-type = 'tuple'
125124

125+
[lint.flake8-tidy-imports]
126+
ban-relative-imports = 'all'
127+
126128
[lint.flake8-quotes]
127129
inline-quotes = 'single'
128130
multiline-quotes = 'double'

0 commit comments

Comments
 (0)