Skip to content

Commit 39802e0

Browse files
committed
Do not use relative imports for modules
This commit changes the `pubtools-marketplacesvm` source modules to use explicit imports instead of relative ones.
1 parent 6c88247 commit 39802e0

File tree

20 files changed

+69
-55
lines changed

20 files changed

+69
-55
lines changed
Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
# SPDX-License-Identifier: GPL-3.0-or-later
2-
from .aws import AWSCredentials, AWSProvider # noqa: F401
3-
from .base import CloudCredentials, CloudProvider, MarketplaceAuth, get_provider # noqa: F401
4-
from .ms_azure import AzureCredentials, AzureProvider # noqa: F401
2+
from pubtools._marketplacesvm.cloud_providers.aws import AWSCredentials, AWSProvider # noqa: F401
3+
from pubtools._marketplacesvm.cloud_providers.base import ( # noqa: F401
4+
CloudCredentials,
5+
CloudProvider,
6+
MarketplaceAuth,
7+
get_provider,
8+
)
9+
from pubtools._marketplacesvm.cloud_providers.ms_azure import ( # noqa: F401
10+
AzureCredentials,
11+
AzureProvider,
12+
)

src/pubtools/_marketplacesvm/cloud_providers/aws.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@
1515
from cloudpub.models.aws import VersionMapping as AWSVersionMapping
1616
from pushsource import AmiPushItem
1717

18-
from .base import UPLOAD_CONTAINER_NAME, CloudCredentials, CloudProvider, register_provider
18+
from pubtools._marketplacesvm.cloud_providers.base import (
19+
UPLOAD_CONTAINER_NAME,
20+
CloudCredentials,
21+
CloudProvider,
22+
register_provider,
23+
)
1924

2025
LOG = logging.getLogger("pubtools.marketplacesvm")
2126
UploadResult = namedtuple("UploadResult", "id") # NOSONAR

src/pubtools/_marketplacesvm/cloud_providers/base.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
# SPDX-License-Identifier: GPL-3.0-or-later
22
import logging
33
import os
4-
import sys
54
from abc import ABC, abstractmethod
65
from typing import Any, Dict, Generic, NoReturn, Optional, Tuple, Type, TypeVar
76

8-
if sys.version_info >= (3, 8):
9-
from typing import TypedDict # pragma: no cover
10-
else:
11-
from typing_extensions import TypedDict # pragma: no cover
12-
137
from attrs import Attribute, field, frozen
148
from attrs.validators import instance_of
159
from pushsource import VMIPushItem
10+
from typing_extensions import TypedDict
1611

1712
log = logging.getLogger("pubtools.marketplacesvm")
1813

src/pubtools/_marketplacesvm/cloud_providers/ms_azure.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@
1212
from cloudpub.ms_azure import AzureService as AzurePublishService
1313
from pushsource import VHDPushItem
1414

15-
from .base import UPLOAD_CONTAINER_NAME, CloudCredentials, CloudProvider, register_provider
15+
from pubtools._marketplacesvm.cloud_providers.base import (
16+
UPLOAD_CONTAINER_NAME,
17+
CloudCredentials,
18+
CloudProvider,
19+
register_provider,
20+
)
1621

1722
LOG = logging.getLogger("pubtools.marketplacesvm")
1823

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# SPDX-License-Identifier: GPL-3.0-or-later
2-
from .cloud import CloudService # noqa: F401
3-
from .collector import CollectorService # noqa: F401
4-
from .starmap import StarmapService # noqa: F401
2+
from pubtools._marketplacesvm.services.cloud import CloudService # noqa: F401
3+
from pubtools._marketplacesvm.services.collector import CollectorService # noqa: F401
4+
from pubtools._marketplacesvm.services.starmap import StarmapService # noqa: F401

src/pubtools/_marketplacesvm/services/cloud.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
from argparse import ArgumentParser
77
from typing import Any, Dict
88

9-
from ..arguments import from_environ
10-
from ..cloud_providers import CloudProvider, MarketplaceAuth, get_provider
11-
from .base import Service
9+
from pubtools._marketplacesvm.arguments import from_environ
10+
from pubtools._marketplacesvm.cloud_providers import CloudProvider, MarketplaceAuth, get_provider
11+
from pubtools._marketplacesvm.services.base import Service
1212

1313
log = logging.getLogger("pubtools.marketplacesvm")
1414

src/pubtools/_marketplacesvm/services/collector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import pushcollector
44

5-
from .base import Service
5+
from pubtools._marketplacesvm.services.base import Service
66

77

88
class CollectorService(Service):

src/pubtools/_marketplacesvm/services/rhsm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
from more_executors.futures import f_map
1919
from pubtools.pluggy import pm
2020

21-
from ..arguments import from_environ
22-
from .base import Service
21+
from pubtools._marketplacesvm.arguments import from_environ
22+
from pubtools._marketplacesvm.services.base import Service
2323

2424
T = TypeVar("T")
2525

src/pubtools/_marketplacesvm/services/starmap.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
from starmap_client.providers import InMemoryMapProviderV2
99
from starmap_client.session import StarmapMockSession, StarmapSession
1010

11-
from ..arguments import RepoFileQueryLoad, RepoQueryLoad
12-
from .base import Service
11+
from pubtools._marketplacesvm.arguments import RepoFileQueryLoad, RepoQueryLoad
12+
from pubtools._marketplacesvm.services.base import Service
1313

1414
log = logging.getLogger("pubtools.marketplacesvm")
1515

src/pubtools/_marketplacesvm/task.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
from pubtools.pluggy import task_context
1111

12-
from .step import StepDecorator
13-
from .utils import BuildIdBorg
12+
from pubtools._marketplacesvm.step import StepDecorator
13+
from pubtools._marketplacesvm.utils import BuildIdBorg
1414

1515
LOG = logging.getLogger("pubtools.marketplacesvm")
1616
LOG_FORMAT = "%(asctime)s [%(levelname)-8s] %(message)s"

src/pubtools/_marketplacesvm/tasks/combined_push/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# SPDX-License-Identifier: GPL-3.0-or-later
2-
from .command import CombinedVMPush
2+
from pubtools._marketplacesvm.tasks.combined_push.command import CombinedVMPush
33

44

55
def entry_point(cls=CombinedVMPush):

src/pubtools/_marketplacesvm/tasks/combined_push/command.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
from more_executors import Executors
66

7-
from ...arguments import SplitAndExtend
8-
from ...services import CloudService, StarmapService
9-
from ...services.rhsm import AwsRHSMClientService
10-
from ...task import RUN_RESULT, MarketplacesVMTask
11-
from ..community_push import CommunityVMPush
12-
from ..push import MarketplacesVMPush
7+
from pubtools._marketplacesvm.arguments import SplitAndExtend
8+
from pubtools._marketplacesvm.services import CloudService, StarmapService
9+
from pubtools._marketplacesvm.services.rhsm import AwsRHSMClientService
10+
from pubtools._marketplacesvm.task import RUN_RESULT, MarketplacesVMTask
11+
from pubtools._marketplacesvm.tasks.community_push import CommunityVMPush
12+
from pubtools._marketplacesvm.tasks.push import MarketplacesVMPush
1313

1414
log = logging.getLogger("pubtools.marketplacesvm")
1515

src/pubtools/_marketplacesvm/tasks/community_push/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# SPDX-License-Identifier: GPL-3.0-or-later
2-
from .command import CommunityVMPush
2+
from pubtools._marketplacesvm.tasks.community_push.command import CommunityVMPush
33

44

55
def entry_point(cls=CommunityVMPush):

src/pubtools/_marketplacesvm/tasks/community_push/command.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@
1212
from starmap_client.models import Destination, Workflow
1313
from typing_extensions import NotRequired
1414

15+
from pubtools._marketplacesvm.cloud_providers.aws import name_from_push_item
16+
from pubtools._marketplacesvm.services.rhsm import AwsRHSMClientService
17+
from pubtools._marketplacesvm.task import RUN_RESULT
1518
from pubtools._marketplacesvm.tasks.community_push.items import ReleaseType, enrich_push_item
16-
17-
from ...cloud_providers.aws import name_from_push_item
18-
from ...services.rhsm import AwsRHSMClientService
19-
from ...task import RUN_RESULT
20-
from ...utils import CLOUD_NAME_FOR_PI
21-
from ..push import MarketplacesVMPush
22-
from ..push.items import MappedVMIPushItemV2, State
19+
from pubtools._marketplacesvm.tasks.push import MarketplacesVMPush
20+
from pubtools._marketplacesvm.tasks.push.items import MappedVMIPushItemV2, State
21+
from pubtools._marketplacesvm.utils import CLOUD_NAME_FOR_PI
2322

2423
log = logging.getLogger("pubtools.marketplacesvm")
2524

src/pubtools/_marketplacesvm/tasks/delete/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# SPDX-License-Identifier: GPL-3.0-or-later
2-
from .command import VMDelete
2+
from pubtools._marketplacesvm.tasks.delete.command import VMDelete
33

44

55
def entry_point(cls=VMDelete):

src/pubtools/_marketplacesvm/tasks/delete/command.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
from attrs import asdict, evolve
99
from pushsource import AmiPushItem, Source, VHDPushItem, VMIPushItem
1010

11-
from ...arguments import SplitAndExtend
12-
from ...services import CloudService, CollectorService
13-
from ...services.rhsm import AwsRHSMClientService
14-
from ...task import RUN_RESULT, MarketplacesVMTask
15-
from ..push.items import State
11+
from pubtools._marketplacesvm.arguments import SplitAndExtend
12+
from pubtools._marketplacesvm.services import CloudService, CollectorService
13+
from pubtools._marketplacesvm.services.rhsm import AwsRHSMClientService
14+
from pubtools._marketplacesvm.task import RUN_RESULT, MarketplacesVMTask
15+
from pubtools._marketplacesvm.tasks.push.items import State
1616

1717
log = logging.getLogger("pubtools.marketplacesvm")
1818

src/pubtools/_marketplacesvm/tasks/push/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# SPDX-License-Identifier: GPL-3.0-or-later
2-
from .command import MarketplacesVMPush
2+
from pubtools._marketplacesvm.tasks.push.command import MarketplacesVMPush
33

44

55
def entry_point(cls=MarketplacesVMPush):

src/pubtools/_marketplacesvm/tasks/push/command.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
from pushsource import Source, VMIPushItem
1212
from starmap_client.models import QueryResponseEntity, Workflow
1313

14-
from ...arguments import SplitAndExtend
15-
from ...services import CloudService, CollectorService, StarmapService
16-
from ...task import RUN_RESULT, MarketplacesVMTask
17-
from ...utils import CLOUD_NAME_FOR_PI
18-
from ..push.items import MappedVMIPushItemV2, State
14+
from pubtools._marketplacesvm.arguments import SplitAndExtend
15+
from pubtools._marketplacesvm.services import CloudService, CollectorService, StarmapService
16+
from pubtools._marketplacesvm.task import RUN_RESULT, MarketplacesVMTask
17+
from pubtools._marketplacesvm.tasks.push.items import MappedVMIPushItemV2, State
18+
from pubtools._marketplacesvm.utils import CLOUD_NAME_FOR_PI
1919

2020
log = logging.getLogger("pubtools.marketplacesvm")
2121
UPLOAD_RESULT = Tuple[MappedVMIPushItemV2, QueryResponseEntity]
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# The import below is just used to register the converter in MappedVMIPushItem
2-
from .ami import aws_security_groups_converter # noqa: F401
3-
from .starmap import MappedVMIPushItemV2 # noqa: F401
4-
from .state import State # noqa: F401
2+
from pubtools._marketplacesvm.tasks.push.items.ami import ( # noqa: F401 E501
3+
aws_security_groups_converter,
4+
)
5+
from pubtools._marketplacesvm.tasks.push.items.starmap import MappedVMIPushItemV2 # noqa: F401
6+
from pubtools._marketplacesvm.tasks.push.items.state import State # noqa: F401

src/pubtools/_marketplacesvm/tasks/push/items/ami.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from pushsource import AmiAccessEndpointUrl, AmiSecurityGroup
55

6-
from .starmap import MappedVMIPushItemV2
6+
from pubtools._marketplacesvm.tasks.push.items.starmap import MappedVMIPushItemV2
77

88
log = logging.getLogger(__name__)
99

0 commit comments

Comments
 (0)