launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #29049
[Merge] ~cjwatson/launchpad:flake8-absolute-import into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:flake8-absolute-import into launchpad:master.
Commit message:
Enforce absolute imports
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/428789
Launchpad's Python style guide requires these. I happened to notice some relative imports in a recent MP, but there's no need for this to be up to reviewers to catch; enforce absolute imports mechanically instead.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:flake8-absolute-import into launchpad:master.
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index d1b37f1..63ab21e 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -53,6 +53,8 @@ repos:
hooks:
- id: flake8
exclude: ^lib/contrib/
+ additional_dependencies:
+ - flake8-absolute-import==1.0.0.1
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v4.2.0
hooks:
diff --git a/lib/lp/services/feeds/browser.py b/lib/lp/services/feeds/browser.py
index d07c793..e656fee 100644
--- a/lib/lp/services/feeds/browser.py
+++ b/lib/lp/services/feeds/browser.py
@@ -21,10 +21,7 @@ __all__ = [
"RootAnnouncementsFeedLink",
]
-from typing import (
- Tuple,
- Type,
- )
+from typing import Tuple, Type
from zope.component import getUtility
from zope.interface import implementer
diff --git a/lib/lp/services/webapp/vocabulary.py b/lib/lp/services/webapp/vocabulary.py
index e7e4d2c..fb51fbc 100644
--- a/lib/lp/services/webapp/vocabulary.py
+++ b/lib/lp/services/webapp/vocabulary.py
@@ -22,10 +22,7 @@ __all__ = [
]
from collections import namedtuple
-from typing import (
- Optional,
- Union,
- )
+from typing import Optional, Union
import six
from storm.base import Storm
diff --git a/lib/lp/testing/__init__.py b/lib/lp/testing/__init__.py
index dfdb2fd..c7a926c 100644
--- a/lib/lp/testing/__init__.py
+++ b/lib/lp/testing/__init__.py
@@ -60,16 +60,13 @@ import subprocess
import sys
import tempfile
import time
-from typing import (
- Type,
- TYPE_CHECKING,
- )
import unittest
from contextlib import contextmanager
from datetime import datetime, timedelta
from fnmatch import fnmatchcase
from functools import partial
from select import select
+from typing import TYPE_CHECKING, Type
import fixtures
import lp_sitecustomize
@@ -158,7 +155,6 @@ from lp.testing.fixture import CaptureOops, ZopeEventHandlerFixture
from lp.testing.karma import KarmaRecorder
from lp.testing.mail_helpers import pop_notifications
-
if TYPE_CHECKING:
from lp.testing.layers import BaseLayer
Follow ups